/*==================================================
project:       Cleans up SISBEN for use
Author:        David L. Vargas 
E-email:       davidvar@iadb.org
url:           
Dependencies:  
----------------------------------------------------
Creation Date:    15 Aug 2022 - 11:03:23
Modification Date:   
Do-file version:    01
References:          
Output:             
==================================================*/

 /*==================================================
               0: Program set up
 ==================================================*/
 *Written on STATA 17
 drop _all
 set varabbrev off	// no variable abbreviations allowed (personal preference)
 
 /*==================================================
               1: loading data
 ==================================================*/
 
 
 *============ 1.0.1: Load data aux 

/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------

			***** Admin data is has restrincted access. ******

 // add missing info 
 use "${dir3r}/02_admin/SISBEN_framing_sample.dta", clear 
 keep if survey_sample == 1
 *keep id_hogar fec_nacimiento_df sexo_persona_sf epovline_depto_2019 epovline_city_2019 epovline_depto_2020 epovline_city_2020 epovline_depto_2021 epovline_city_2021 povline_depto_2019 povline_city_2019 povline_depto_2020 povline_city_2020 povline_depto_2021 povline_city_2021 nat_pvl_2019 nat_rural_pvl_2019 nat_epvl_2019 nat_rural_epvl_2019 nat_pvl_2020 nat_rural_pvl_2020 nat_epvl_2020 nat_rural_epvl_2020 nat_pvl_2021 nat_rural_pvl_2021 nat_epvl_2021 nat_rural_epvl_2021 ppp_2019 ppp_2020 ppp_2021
 rename (fec_nacimiento_df sexo_persona_sf) (fec_nacimiento_sisben sexo_persona_sisben)
 rename id_hogar id_hogar_SISBEN
 
 drop survey_sample urban
 
 loc vars ""
 foreach v of varlist _all {
	loc vlab : var lab `v'
	lab var `v' "SISBEN - `vlab'"
	loc vars "`vars' `v'"
 }
 
 loc sisbenvar = subinstr("`vars'", "id_hogar_SISBEN" , "",.)
 glo sisbenvar "`sisbenvar'"
 
 tempfile sisbendt
 save `sisbendt', replace

----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 *============ 1.1: Load data from crypted
 // This is the main dataset
 use "${dir2r}/survey_data/COL_SISBEN_Hogar_CP_IDB.dta", clear
 
 /* Overall notes:
	These is the whole list of datasets
	 * COL_SISBEN_ActivoA_RD_IDB
	 * COL_SISBEN_ActivoB_RD_IDB
	 * COL_SISBEN_Hogar_CP_IDB
	 * COL_SISBEN_Perdida_RD_IDB
 */
 
 /*==================================================
 			2: Cleaning
 ==================================================*/
 
  /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 ***** Admin data is has restrincted access. ******

 *--------- Add SISBEN missing info 
 
 merge 1:1 id_hogar_SISBEN using `sisbendt', assert(1 3) nogen

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/

 *---------------- 2.0: Cati Intro 
 
 //>>>> 2.0.1. Rubbish cleaning 
 
 * variables w/out variation or reasonable use
 drop pais // All Colombia
 
 //>>>> 2.0.2 Additional variables / transformations 
 * Dummy urban 
 gen urban = urb_rur == 1 , after(urb_rur)
 lab define lurb 1 "Urban" 2 "Rural", modify
 lab values urb_rur lurb 
 
 //>>>> 2.0.3. Section ordering
 order id_vivienda_SISBEN id_hogar_SISBEN ID_hogar /*grupo_SISBEN clasificador*/ urban, first
 /* Note: comment out is admin data */
 
 *---------------- 2.1: Cover
 
 //>>>> 2.1.1. Rubbish cleaning 
 * variales w/out infomation 
 drop q01_04 q01_06
 
 //>>>> 2.1.2 Additional variables / transformations 
 * Simple accept reject dummy
 rename q01_07 q01_07det
 gen q01_07 = 1 if q01_07det == 1 , before(q01_07det)
 
 * Transform YES and No to dummies
 foreach v of varlist q01_01 q01_02 q01_03 q01_07  {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 //>>>> 2.1.3 Variables relabel
 lab var q01_01		 "Answered the phone" 
 lab var q01_02		 "Stayed on the line" 
 lab var q01_03		 "Is registered SISBEN contact" 
 lab var q01_05		 "Is in charge of the household finances" 
 lab var q01_07		 "Accepts to participate" // this varible needs checking
 lab var q01_07det 	 "Accepts to participate (detail)"
 lab var q01_08 	 "Allows to record the call"
 
 //>>>> 2.1.4. Section ordering
 * change variables prefix to better reflect the section of the survey
 rename q01_* cover_*
 * order
 order cover_* , last 

 
 *---------------- 2.2: Hogar (household)
 
 //>>>> 2.2.1. Rubbish cleaning 
 * variales w/out infomation 
 
 
 //>>>> 2.2.2 Additional variables / transformations 
 * Dummy interviewee is the head 
 gen q02_resp_head = q02_05 == 1 , after(q02_05)
 * sex 
 gen q02_male = q02_03 == 1
 gen q02_female = q02_03 == 2
 /*----------------------------------------------------------------------
		-------------------- PII DATA 	-----------------------
------------------------------------------------------------------------
 * Breadwinner DOB
 gen q02_13 =mdy(q02_13b_mm, q02_13a_dd, q02_13c_aa) , before(q02_13a_dd)
 format q02_13 %d
  ----------------------------------------------------------------------
	--------------------  PII DATA END 	-----------------------
------------------------------------------------------------------------*/
 
/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 ***** Admin data is has restrincted access. ******

 // Complete DOB from SISBEN
 rename fec_nacimiento_sisben q02_13_sisben 
 gen q02_14_sisben = floor((mofd(date("2021-11-01", "YMD")) - mofd(q02_13_sisben))/12)
 order q02_13_sisben, after(q02_13)
 order q02_14_sisben, after(q02_14)
 lab var q02_13_sisben "SISBEN: DOB | titular"
 lab var q02_14_sisben "SISBEN: Age Nov 2021 | titular"


 replace q02_13 = q02_13_sisben if q02_01 == 1
 replace q02_14 = q02_14_sisben if q02_01 == 1
 
 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 // Replace relationship if titular
 replace q03_15 = 1 			if q03_01 == 1
 
 * breadwinner is head 
 *gen q02_15_head = q02_15 == 1
 * breadwinner educational attaiment dummies
 gen q02_16aa = q02_16a == 1
 gen q02_16ab = q02_16a == 2
 gen q02_16ac = q02_16a == 3
 gen q02_16ad = q02_16a == 4
 gen q02_16ae = q02_16a == 5
 gen q02_16af = q02_16a == 6
 gen q02_16ag = q02_16a == 7
 gen q02_16ah = q02_16a == 8
 gen q02_16ai = q02_16a == 98
 
 replace q02_16b = 0 if q02_16aa == 1
 
 //>>>> 2.2.3 Variables relabel
 lab var q02_01 	 	"Interviewee is (or connects) the HH finances manager"	
 lab var q02_03 	 	"Gender of interviewee"	
 lab var q02_male  		"Male interviewee"
 lab var q02_female		"Female interviewee"
 lab var q02_04 	 	"Interviewee's age'"	
 lab var q02_05 	 	"Interviewee's relationship w/ head'"	
 lab var q02_resp_head	"Interviewee is the head of HH"
 lab var q02_06 	 	"Number of households in dwelling (Independent expenses)"	
 lab var q02_07 	 	"Number of HH members"	
 lab var q02_08 	 	"Number of adults (>18)"	
 lab var q02_09 	 	"Number of members before COVID"	
 lab var q02_10 	 	"Number of adults before COVID"	
 *lab var q02_13		 "DOB breadwinner"				//PII 
 *lab var q02_13a_dd  	"Day of birth - breadwinner"	//PII
 *lab var q02_13b_mm  	"Month of birth - breadwinner"	//PII
 *lab var q02_13c_aa  	"Year of birth - breadwinner"	//PII
 lab var q02_14 	 	"Age - breadwinner"	
 lab var q02_15 	 	"Breadwinner's relationship with head"	
 lab var q02_16a	 	"Breadwinner's educational level"	 
 lab var q02_16aa		"Breadwinner's education: None"
 lab var q02_16ab		"Breadwinner's education: Pre-school"
 lab var q02_16ac		"Breadwinner's education: Primary school"
 lab var q02_16ad		"Breadwinner's education: Middle school"
 lab var q02_16ae		"Breadwinner's education: Highschool"
 lab var q02_16af		"Breadwinner's education: Tecnico"
 lab var q02_16ag		"Breadwinner's education: University"
 lab var q02_16ah		"Breadwinner's education: Postgrade"
 lab var q02_16ai		"Breadwinner's education: DNK" 
 lab var q02_16b	 	"Breadwinner's educational level (numeric)"	
 
 //>>>> 2.1.4. Section ordering
 order q02_01 q02_03 q02_male q02_female q02_04 q02_05 q02_resp_head q02_06 ///
 q02_07 q02_08 q02_09 q02_10 /*q02_13 q02_13a_dd q02_13b_mm q02_13c_aa*/ q02_14 ///
 q02_15 q02_16a q02_16aa q02_16ab q02_16ac q02_16ad q02_16ae q02_16af ///
 q02_16ag q02_16ah q02_16ai q02_16b , after(urban) 
 * change variables prefix to better reflect the section of the survey
 rename q02_* hh_*
 
 
 
 *---------------- 2.3: Employment breadwinner
 
 //>>>> 2.3.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.3.2 Additional variables / transformations 
 
 // Transform YES and No to dummies
 foreach v of varlist q03_01 q03_02 q03_04 q03_08 q03_09 q03_11 q03_12 q03_13 q03_15 q03_19 q03_21 q03_22 q03_23 q03_25 q03_29 {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
}
  
 * unpaid work is only ask if didnt work for payment 
 
 * Fix jobloss if not job before
 replace q03_09 = 0 if q03_08 == 0
 
 * fill subject to having the same job
 // same as in 2020 in 2021 
 replace q03_16 = q03_05 		if q03_13 == 1
 replace q03_17 = q03_06 		if q03_13 == 1
 replace q03_18 = q03_07 		if q03_13 == 1
 replace q03_18_ot = q03_07_ot 	if q03_13 == 1
 
 
 // same as in 2019 in 2020
 replace q03_26 = q03_16 		if q03_23 == 1
 replace q03_27 = q03_18 		if q03_23 == 1
 replace q03_27_ot = q03_18_ot 	if q03_23 == 1
 replace q03_28 = q03_17	 	if q03_23 == 1
 
 * Pension fund 
 replace q03_15 = q03_04 if q03_13 == 1
 replace q03_25 = q03_15 if q03_23 == 1
 
 * type of occupation dummies 
 foreach k in "05" "16" "26" {
 	
	if 		("`k'" == "05")	loc yr "2021"
	else if ("`k'" == "16")	loc yr "2020"
	else if ("`k'" == "26")	loc yr "2019"
	else 					loc yr ""					
	
	 gen q03_`k'a = q03_`k' == 1  if !missing(q03_`k')
	 gen q03_`k'b = q03_`k' == 2  if !missing(q03_`k')
	 gen q03_`k'c = q03_`k' == 3  if !missing(q03_`k')
	 gen q03_`k'd = q03_`k' == 4  if !missing(q03_`k')
	 gen q03_`k'e = q03_`k' == 5  if !missing(q03_`k')
	 gen q03_`k'f = q03_`k' == 6  if !missing(q03_`k')
	 gen q03_`k'g = q03_`k' == 7  if !missing(q03_`k')
	 gen q03_`k'h = q03_`k' == 8  if !missing(q03_`k')
	 gen q03_`k'i = q03_`k' == 9  if !missing(q03_`k')
	 gen q03_`k'j = q03_`k' == 98 if !missing(q03_`k')

	 lab var q03_`k'a 	"Occupation `yr': Employee (private sector)"
	 lab var q03_`k'b 	"Occupation `yr': Gov. employee"
	 lab var q03_`k'c 	"Occupation `yr': Domestic worker"
	 lab var q03_`k'd 	"Occupation `yr': Self-employed"
	 lab var q03_`k'e 	"Occupation `yr': Employer"
	 lab var q03_`k'f 	"Occupation `yr': Farm worker"
	 lab var q03_`k'g 	"Occupation `yr': Unpaid worker"
	 lab var q03_`k'h 	"Occupation `yr': Unpaid help"
	 lab var q03_`k'i 	"Occupation `yr': Day labour"
	 lab var q03_`k'j 	"Occupation `yr': DNK"
	 
 }
 
 // fix zeros
 foreach k in "05" "16" "26" {
 	if("`k'"== "05") 	loc cond  "q03_01 == 0 | q03_02 == 0"
	if("`k'"== "16") 	loc cond  "q03_11 == 0 | q03_12 == 0"
	if("`k'"== "26") 	loc cond  "q03_21 == 0 | q03_22 == 0"
	
	 forv i = 1/9{
		loc az : word `i' of `c(alpha)'
		replace q03_`k'`az' = 0 if `cond' // cond on working
	 }
 }
 
 * company's sector dummies
 foreach k in "06" "17" "28" {
 	
	if 		("`k'" == "06")	loc yr "2021"
	else if ("`k'" == "17")	loc yr "2020"
	else if ("`k'" == "28")	loc yr "2019"
    else 					loc yr ""	
	
	 gen q03_`k'a = q03_`k' == 1  if !missing(q03_`k')
	 gen q03_`k'b = q03_`k' == 2  if !missing(q03_`k')
	 gen q03_`k'c = q03_`k' == 3  if !missing(q03_`k')
	 gen q03_`k'd = q03_`k' == 4  if !missing(q03_`k')
	 gen q03_`k'e = q03_`k' == 5  if !missing(q03_`k')
	 gen q03_`k'f = q03_`k' == 6  if !missing(q03_`k')
	 gen q03_`k'g = q03_`k' == 7  if !missing(q03_`k')
	 gen q03_`k'h = q03_`k' == 8  if !missing(q03_`k')
	 gen q03_`k'i = q03_`k' == 9  if !missing(q03_`k')
	 gen q03_`k'j = q03_`k' == 10 if !missing(q03_`k')
	 gen q03_`k'k = q03_`k' == 11 if !missing(q03_`k')
	 gen q03_`k'l = q03_`k' == 12 if !missing(q03_`k')
	 gen q03_`k'm = q03_`k' == 13 if !missing(q03_`k')
	 gen q03_`k'n = q03_`k' == 14 if !missing(q03_`k')
	 gen q03_`k'o = q03_`k' == 15 if !missing(q03_`k')
	 gen q03_`k'p = q03_`k' == 16 if !missing(q03_`k')
	 gen q03_`k'q = q03_`k' == 17 if !missing(q03_`k')
	 gen q03_`k'r = q03_`k' == 18 if !missing(q03_`k')
	 gen q03_`k's = q03_`k' == 19 if !missing(q03_`k')
	 gen q03_`k't = q03_`k' == 20 if !missing(q03_`k')

	 lab var q03_`k'a "Sector `yr': agriculture / livestock / fisheries"
	 lab var q03_`k'b "Sector `yr': mining"
	 lab var q03_`k'c "Sector `yr': manufacturing"
	 lab var q03_`k'd "Sector `yr': professional / scientific / technical activities"
	 lab var q03_`k'e "Sector `yr': electricity / water / gas"
	 lab var q03_`k'f "Sector `yr': construction"
	 lab var q03_`k'g "Sector `yr': transportation"
	 lab var q03_`k'h "Sector `yr': purchase and sale of goods"
	 lab var q03_`k'i "Sector `yr': financial services"
	 lab var q03_`k'j "Sector `yr': personal services and association activities"
	 lab var q03_`k'k "Sector `yr': education"
	 lab var q03_`k'l "Sector `yr': health"
	 lab var q03_`k'm "Sector `yr': public administration, international organisations"
	 lab var q03_`k'n "Sector `yr': restaurants/bars/hotel/hospitality/tourism"
	 lab var q03_`k'o "Sector `yr': repair of household goods and vehicles"
	 lab var q03_`k'p "Sector `yr': information and communications"
	 lab var q03_`k'q "Sector `yr': real estate activities"
	 lab var q03_`k'r "Sector `yr': non-specialised administrative and support services"
	 lab var q03_`k's "Sector `yr': arts, entertainment and recreation"
	 lab var q03_`k't "Sector `yr': domestic household services"

 }
 
 // fix zeros
 foreach k in "06" "17" "28" {
 	if("`k'"== "06") 	loc cond  "q03_01 == 0 | q03_02 == 0"
	if("`k'"== "17") 	loc cond  "q03_11 == 0 | q03_12 == 0"
	if("`k'"== "28") 	loc cond  "q03_21 == 0 | q03_22 == 0"
	
	 forv i = 1/20{
		loc az : word `i' of `c(alpha)'
		replace q03_`k'`az' = 0 if `cond' // cond on working
	 }
 }
 
 
 
 * place of work 
 foreach k in "07" "18" "27" {
 	
	if 		("`k'" == "06")	loc yr "2021"
	else if ("`k'" == "18")	loc yr "2020"
	else if ("`k'" == "27")	loc yr "2019"
    else 					loc yr ""	
	
 
	 gen q03_`k'a  = q03_`k' == 1  if !missing(q03_`k')
	 gen q03_`k'b  = q03_`k' == 2  if !missing(q03_`k')
	 gen q03_`k'c  = q03_`k' == 3  if !missing(q03_`k')
	 gen q03_`k'd  = q03_`k' == 4  if !missing(q03_`k')
	 gen q03_`k'e  = q03_`k' == 5  if !missing(q03_`k')
	 gen q03_`k'f  = q03_`k' == 6  if !missing(q03_`k')
	 gen q03_`k'g  = q03_`k' == 7  if !missing(q03_`k')
	 gen q03_`k'h  = q03_`k' == 8  if !missing(q03_`k')
	 gen q03_`k'i  = q03_`k' == 9  if !missing(q03_`k')
	 gen q03_`k'j  = q03_`k' == 10 if !missing(q03_`k')
	 gen q03_`k'k  = q03_`k' == 97 if !missing(q03_`k')
	 gen q03_`k'z  = q03_`k' == 98 if !missing(q03_`k')
	 
	 lab var q03_`k'a "Work place: Own dwelling"
	 lab var q03_`k'b "Work place: other dwellings"
	 lab var q03_`k'c "Work place: kiosk-case"
	 lab var q03_`k'd "Work place: vehicle"
	 lab var q03_`k'e "Work place: door to door"
	 lab var q03_`k'f "Work place: uncovered place in the street"
	 lab var q03_`k'g "Work place: fixed premises, office"
	 lab var q03_`k'h "Work place: countryside or rural area, sea or river"
	 lab var q03_`k'i "Work place: construction site"
	 lab var q03_`k'j "Work place: mine or quarry"
	 lab var q03_`k'k "Work place: OTHER"
	 lab var q03_`k'z "Work place: DNK"
 
 }
 
  // fix zeros
 foreach k in "07" "18" "27" {
 	if("`k'"== "07") 	loc cond  "q03_01 == 0 | q03_02 == 0"
	if("`k'"== "18") 	loc cond  "q03_11 == 0 | q03_12 == 0"
	if("`k'"== "27") 	loc cond  "q03_21 == 0 | q03_22 == 0"
	
	 forv i = 1/11{
		loc az : word `i' of `c(alpha)'
		replace q03_`k'`az' = 0 if `cond' // cond on working
	 }
 }
 
 * pension fund (zero if not working)
 replace q03_04 = 0 if q03_01 == 0 | q03_02 == 0
 replace q03_15 = 0 if q03_11 == 0 | q03_12 == 0
 replace q03_25 = 0 if q03_21 == 0 | q03_22 == 0
 
 //>>>> 2.3.3 Variables relabel
 lab var q03_01 		"Paid work at least one hour past month - breadwinner"	
 lab var q03_02 		"Unpaid work at least one hour past month - breadwinner"	
 lab var q03_03 		"Occupation description - breadwinner"	
 lab var q03_04 		"Contributes to pension fund - breadwinner"	
 lab var q03_05 		"Type of occupation - breadwinner"	
 lab var q03_06 		"Company's sector - breadwinner"	
 lab var q03_07 		"Place of work - breadwinner"	
 lab var q03_07_ot 		"Place of work other - breadwinner"
 lab var q03_08 		"Worked for a wage or self-employed in 2021 - breadwinner"
 lab var q03_09 		"Involuntary job lost in 2021 - breadwinner"
 lab var q03_10 		"Month of job lost 2021 - breadwinner" 
 lab var q03_11 		"Paid work at least one hour past month  - Nov 2020 - breadwinner"
 lab var q03_12 		"Unpaid work at least one hour past month - Nov 2020 - breadwinner"
 lab var q03_13 		"Same as current occupation - Nov 2020 - breadwinner"
 lab var q03_14 		"Occupation description  - Nov 2020 - breadwinner"
 lab var q03_15 		"Contributes to pension - Nov 2020 - breadwinner"
 lab var q03_16 		"Type of occupation - Nov 2020 - breadwinner"
 lab var q03_17 		"Company's sector -  - Nov 2020 - breadwinner"
 lab var q03_18 		"Place of work - Nov 2020 - breadwinner"
 lab var q03_18_ot 		"Place of work other - Nov 2020 - breadwinner"
 lab var q03_19 		"Involuntary job lost in 2020 - breadwinner"
 lab var q03_20 		"Month of job lost 2020 - breadwinner" 
 lab var q03_21 		"Paid work at least one hour past month  - Nov 2019 - breadwinner"
 lab var q03_22 		"Unpaid work at least one hour past month - Nov 2019 - breadwinner"
 lab var q03_23 		"Same as Nov 2020 occupation - Nov 2019 - breadwinner"
 lab var q03_24 		"Occupation description  - Nov 2019 - breadwinner"
 lab var q03_25 		"Contributes to pension - Nov 2019 - breadwinner"
 lab var q03_26 		"Type of occupation - Nov 2019 - breadwinner"
 lab var q03_27 		"Place of work - Nov 2019 - breadwinner"
 lab var q03_27_ot 		"Place of work other - Nov 2019 - breadwinner"
 lab var q03_28			"Company's sector -  - Nov 2019 - breadwinner"
 lab var q03_29			"Involuntary job lost in 2019 - breadwinner"
 lab var q03_30			"Month of job lost 2019 - breadwinner" 
 
 //>>>> 2.3.4. Section ordering
 order q03_01 q03_02 q03_03 q03_04 q03_05* q03_06* q03_07* q03_07_ot q03_08 q03_09 ///
 q03_10 q03_11 q03_12 q03_13 q03_14 q03_15 q03_16* q03_17* q03_18* q03_18_ot q03_19 ///
 q03_20 q03_21 q03_22 q03_23 q03_24 q03_25 q03_26* q03_27* q03_27_ot q03_28* q03_29 ///
 q03_30 , after(hh_16b)

 rename q03_* labour_*
 
 *---------------- 2.4: Income 

 //>>>> 2.4.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.4.2 Additional variables / transformations 
 * Transform YES and No to dummies
 foreach v of varlist q04_04 q04_05a q04_05b q04_05c q04_05d q04_05e q04_05f q04_05g q04_05h q04_05i q04_05j q04_05k q04_05l q04_06a q04_06b q04_06c q04_06d q04_06e q04_06f q04_06g q04_06h q04_06i q04_06j q04_06k q04_06l q04_07a q04_07b q04_07c q04_07d q04_07z q04_11 q04_12a q04_12b q04_12c q04_12d q04_12e q04_12f q04_12g q04_12h q04_12i q04_12j q04_12k q04_12l q04_13a q04_13b q04_13c q04_13d q04_13e q04_13f q04_13g q04_13h q04_13i q04_13j q04_13k q04_13l q04_14a q04_14b q04_14c q04_14d q04_14z q04_18 q04_19a q04_19b q04_19c q04_19d q04_19e q04_19f q04_19g q04_19h q04_19i q04_19j q04_19k q04_19l q04_20a q04_20b q04_20c q04_20d q04_20e q04_20f q04_20g q04_20h q04_20i q04_20j q04_20k q04_20l q04_21a q04_21b q04_21c q04_21d q04_21z {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 * fix total income missing
 replace q04_01 = . if q04_01 == -1
 replace q04_03b = . if q04_03b == -1
 replace q04_03c = . if q04_03c == -1
 
 replace q04_08 = . if q04_08 == -1
 replace q04_10b = . if q04_10b == -1
 replace q04_10c = . if q04_10c == -1
 
 replace q04_15 = . if q04_15 == -1
 replace q04_17b = . if q04_17b == -1
 replace q04_17c = . if q04_17c == -1
 
 
 
 * input incomes to cat midpoint if missing 
   *q04_01 q04_08 q04_15
 foreach v in q04_02 q04_09 q04_16 { 
  
	 gen _aux = . 
	 
	 replace _aux = (0 + 250001) / 2			if `v' == 1
	 replace _aux = (250001 + 400000 ) / 2		if `v' == 2
	 replace _aux = (400001 + 900000 ) / 2		if `v' == 3
	 replace _aux = (900001 + 1100000) / 2		if `v' == 4
	 replace _aux = (1100001 + 1600000)	/ 2		if `v' == 5
	 replace _aux = (1600001 + 1900000)	/ 2		if `v' == 6
	 replace _aux = (1900001 + 2600000)	/ 2		if `v' == 7
	 replace _aux = (2600001 + 3800000) / 2		if `v' == 8

	 if ("`v'"=="q04_02") replace q04_01 = _aux if q04_01 == .
	 if ("`v'"=="q04_09") replace q04_08 = _aux if q04_08 == .
	 if ("`v'"=="q04_16") replace q04_15 = _aux if q04_15 == .
	 
	 drop _aux
 }
 
 
 //>>>> 2.4.3 Variables relabel
 lab var q04_01 			"Total HH monthly income - 2021" 
 lab var q04_02 			"Total HH monthly income category - 2021" 
 lab var q04_03b			"Monthly income from pension payments - 2021"  
 lab var q04_03c			"Monthly income from goverment programs - 2021"  
 lab var q04_04 			"Income below one-half of the usual monthly income any given month - 2021" 
 lab var q04_05a			"Income below one-half - Jan 2021"  
 lab var q04_05b			"Income below one-half - Feb 2021"  
 lab var q04_05c			"Income below one-half - Mar 2021"  
 lab var q04_05d			"Income below one-half - Apr 2021"  
 lab var q04_05e			"Income below one-half - May 2021"  
 lab var q04_05f			"Income below one-half - Jun 2021"  
 lab var q04_05g			"Income below one-half - Jul 2021"  
 lab var q04_05h			"Income below one-half - Aug 2021"  
 lab var q04_05i			"Income below one-half - Sep 2021"  
 lab var q04_05j			"Income below one-half - Oct 2021"  
 lab var q04_05k			"Income below one-half - Nov 2021"  
 lab var q04_05l			"Income below one-half - Dec 2021"  
 lab var q04_06a			"No income- Jan 2021"  
 lab var q04_06b			"No income- Feb 2021"  
 lab var q04_06c			"No income- Mar 2021"  
 lab var q04_06d			"No income- Apr 2021"  
 lab var q04_06e			"No income- May 2021"  
 lab var q04_06f			"No income- Jun 2021"  
 lab var q04_06g			"No income- Jul 2021"  
 lab var q04_06h			"No income- Aug 2021"  
 lab var q04_06i			"No income- Sep 2021"  
 lab var q04_06j			"No income- Oct 2021"  
 lab var q04_06k			"No income- Nov 2021"  
 lab var q04_06l			"No income- Dec 2021"  
 lab var q04_07a			"Reason of income reduction 2021 - worked less"  
 lab var q04_07b			"Reason of income reduction 2021 - someone worked less"  
 lab var q04_07c			"Reason of income reduction 2021 - got sick"  
 lab var q04_07d			"Reason of income reduction 2021 - someone got sick"  
 lab var q04_07_ot 			"Reason of income reduction 2021 - other (description)" 
 lab var q04_07z 			"Reason of income reduction 2021 - other" 					
 lab var q04_08 			"Total HH monthly income - 2020" 
 lab var q04_09 			"Total HH monthly income category - 2020"
 lab var q04_10b 			"Monthly income from pension payments - 2020"  
 lab var q04_10c 			"Monthly income from goverment programs - 2020"  
 lab var q04_11 			"Income below one-half of the usual monthly income any given month - 2020"
 lab var q04_12a 			"Income below one-half - Jan 2020"  
 lab var q04_12b 			"Income below one-half - Feb 2020"  
 lab var q04_12c 			"Income below one-half - Mar 2020"  
 lab var q04_12d 			"Income below one-half - Apr 2020"  
 lab var q04_12e 			"Income below one-half - May 2020"  
 lab var q04_12f 			"Income below one-half - Jun 2020"  
 lab var q04_12g 			"Income below one-half - Jul 2020"  
 lab var q04_12h 			"Income below one-half - Aug 2020"  
 lab var q04_12i 			"Income below one-half - Sep 2020"  
 lab var q04_12j 			"Income below one-half - Oct 2020"  
 lab var q04_12k 			"Income below one-half - Nov 2020"  
 lab var q04_12l 			"Income below one-half - Dec 2020"  
 lab var q04_13a 			"No income- Jan 2020"  
 lab var q04_13b 			"No income- Feb 2020"  
 lab var q04_13c 			"No income- Mar 2020"  
 lab var q04_13d 			"No income- Apr 2020"  
 lab var q04_13e 			"No income- May 2020"  
 lab var q04_13f 			"No income- Jun 2020"  
 lab var q04_13g 			"No income- Jul 2020"  
 lab var q04_13h 			"No income- Aug 2020"  
 lab var q04_13i 			"No income- Sep 2020"  
 lab var q04_13j 			"No income- Oct 2020"  
 lab var q04_13k 			"No income- Nov 2020"  
 lab var q04_13l 			"No income- Dec 2020"  
 lab var q04_14a 			"Reason of income reduction 2020 - worked less"  
 lab var q04_14b 			"Reason of income reduction 2020 - other worked less"  
 lab var q04_14c 			"Reason of income reduction 2020 - got sick"  
 lab var q04_14d 			"Reason of income reduction 2020 - other got sick"  
 lab var q04_14_ot 			"Reason of income reduction 2020 - other (description)" 
 lab var q04_14z 			"Reason of income reduction 2020 - other" 										
 lab var q04_15 			"Total HH monthly income - 2019" 
 lab var q04_16 			"Total HH monthly income category - 2019" 
 lab var q04_17b 			"Monthly income from pension payments - 2019"   
 lab var q04_17c 			"Monthly income from goverment programs - 2019"   
 lab var q04_18 			"Income below one-half of the usual monthly income any given month - 2019" 
 lab var q04_19a 			"Income below one-half - Jan 2019"   
 lab var q04_19b 			"Income below one-half - Feb 2019"   
 lab var q04_19c 			"Income below one-half - Mar 2019"   
 lab var q04_19d 			"Income below one-half - Apr 2019"   
 lab var q04_19e 			"Income below one-half - May 2019"   
 lab var q04_19f 			"Income below one-half - Jun 2019"   
 lab var q04_19g 			"Income below one-half - Jul 2019"   
 lab var q04_19h 			"Income below one-half - Aug 2019"   
 lab var q04_19i 			"Income below one-half - Sep 2019"   
 lab var q04_19j 			"Income below one-half - Oct 2019"   
 lab var q04_19k 			"Income below one-half - Nov 2019"   
 lab var q04_19l 			"Income below one-half - Dec 2019"   
 lab var q04_20a 			"No income- Jan 2019"   
 lab var q04_20b 			"No income- Feb 2019"   
 lab var q04_20c 			"No income- Mar 2019"   
 lab var q04_20d 			"No income- Apr 2019"   
 lab var q04_20e 			"No income- May 2019"   
 lab var q04_20f 			"No income- Jun 2019"   
 lab var q04_20g 			"No income- Jul 2019"   
 lab var q04_20h 			"No income- Aug 2019"   
 lab var q04_20i 			"No income- Sep 2019"   
 lab var q04_20j 			"No income- Oct 2019"   
 lab var q04_20k 			"No income- Nov 2019"   
 lab var q04_20l 			"No income- Dec 2019"   
 lab var q04_21a 			"Reason of income reduction 2019 - worked less"   
 lab var q04_21b 			"Reason of income reduction 2019 - other worked less"   
 lab var q04_21c 			"Reason of income reduction 2019 - got sick"   
 lab var q04_21d 			"Reason of income reduction 2019 - other got sick"   
 lab var q04_21_ot 			"Reason of income reduction 2019 - other (description)"  
 lab var q04_21z			"Reason of income reduction 2019 - other" 			
 
 
 //>>>> 2.4.4. Section ordering
 order q04_01 q04_02 q04_03b	q04_03c	q04_04 q04_05a	q04_05b	q04_05c	q04_05d ///
 q04_05e	q04_05f	q04_05g	q04_05h	q04_05i	q04_05j	q04_05k	q04_05l	q04_06a	///
 q04_06b	q04_06c	q04_06d	q04_06e	q04_06f	q04_06g	q04_06h	q04_06i	q04_06j	///
 q04_06k	q04_06l	q04_07a	q04_07b	q04_07c	q04_07d q04_07z q04_07_ot q04_08 ///
 q04_09 q04_10b q04_10c q04_11 q04_12a q04_12b q04_12c q04_12d q04_12e q04_12f ///
 q04_12g q04_12h q04_12i q04_12j q04_12k q04_12l q04_13a q04_13b q04_13c q04_13d ///
 q04_13e q04_13f q04_13g q04_13h q04_13i q04_13j q04_13k q04_13l q04_14a q04_14b ///
 q04_14c q04_14d q04_14z q04_14_ot q04_15 q04_16 q04_17b q04_17c q04_18 q04_19a ///
 q04_19b q04_19c q04_19d q04_19e q04_19f q04_19g q04_19h q04_19i q04_19j q04_19k ///
 q04_19l q04_20a q04_20b q04_20c q04_20d q04_20e q04_20f q04_20g q04_20h q04_20i ///
 q04_20j q04_20k q04_20l q04_21a q04_21b q04_21c q04_21d q04_21z q04_21_ot, ///
 after(labour_30)

 rename q04_* income_*
 
 //>>>>> Replace conditinal valued answers 
 
 * Income reduction
 // 2021
 foreach v in income_05a income_05b income_05c income_05d income_05e income_05f income_05g income_05h income_05i income_05j income_05k income_05l income_06a income_06b income_06c income_06d income_06e income_06f income_06g income_06h income_06i income_06j income_06k income_06l {
	replace `v' = 0 if `v' == . & income_04 != .
 }
 
 foreach v in income_07a income_07b income_07c income_07d income_07z {
	replace `v' = 0 if `v' == . & income_04 == 1
 }
 
 // 2021
 foreach v in income_12a income_12b income_12c income_12d income_12e income_12f income_12g income_12h income_12i income_12j income_12k income_12l income_13a income_13b income_13c income_13d income_13e income_13f income_13g income_13h income_13i income_13j income_13k income_13l {
	replace `v' = 0 if `v' == . & income_11 != .
 }
 
 foreach v in income_14a income_14b income_14c income_14d income_14z {
	replace `v' = 0 if `v' == . & income_11 == 1
 }
 
 // 2019
 foreach v in income_19a income_19b income_19c income_19d income_19e income_19f income_19g income_19h income_19i income_19j income_19k income_19l income_20a income_20b income_20c income_20d income_20e income_20f income_20g income_20h income_20i income_20j income_20k income_20l {
	replace `v' = 0 if `v' == . & income_18 != .
 }
 
 foreach v in income_21a income_21b income_21c income_21d income_21z {
	replace `v' = 0 if `v' == . & income_18 == 1
 }
 
 

 
 *---------------- 2.5: Expenses and food security 
 
  //>>>> 2.5.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.5.2 Additional variables / transformations 
 * Transform YES and No to dummies
 foreach v of varlist q05_01 q05_02a q05_02b q05_02c q05_02d q05_02e q05_02f q05_02g q05_02h q05_02i q05_02j q05_02k q05_02l q05_03 q05_04a q05_04b q05_04c q05_04d q05_04e q05_04f q05_04g q05_04h q05_04i q05_04j q05_04k q05_04l q05_05 q05_06a q05_06b q05_06c q05_06d q05_06e q05_06f q05_06g q05_06h q05_06i q05_06j q05_06k q05_06l {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 //>>>> 2.5.3 Variables relabel
 lab var q05_01 		"Has gone hungry because of lack of resources - 2019"
 lab var q05_02a		"Went hungry - Jan 2019" 
 lab var q05_02b		"Went hungry - Feb 2019" 
 lab var q05_02c		"Went hungry - Mar 2019" 
 lab var q05_02d		"Went hungry - Apr 2019" 
 lab var q05_02e		"Went hungry - May 2019" 
 lab var q05_02f		"Went hungry - Jun 2019" 
 lab var q05_02g		"Went hungry - Jul 2019" 
 lab var q05_02h		"Went hungry - Aug 2019" 
 lab var q05_02i		"Went hungry - Sep 2019" 
 lab var q05_02j		"Went hungry - Oct 2019" 
 lab var q05_02k		"Went hungry - Nov 2019" 
 lab var q05_02l		"Went hungry - Dec 2019" 								
 lab var q05_03 		"Has gone hungry because of lack of resources - 2020"
 lab var q05_04a		"Went hungry - Jan 2020"  
 lab var q05_04b		"Went hungry - Feb 2020"  
 lab var q05_04c		"Went hungry - Mar 2020"  
 lab var q05_04d		"Went hungry - Apr 2020"  
 lab var q05_04e		"Went hungry - May 2020"  
 lab var q05_04f		"Went hungry - Jun 2020"  
 lab var q05_04g		"Went hungry - Jul 2020"  
 lab var q05_04h		"Went hungry - Aug 2020"  
 lab var q05_04i		"Went hungry - Sep 2020"  
 lab var q05_04j		"Went hungry - Oct 2020"  
 lab var q05_04k		"Went hungry - Nov 2020"  
 lab var q05_04l		"Went hungry - Dec 2020" 								 
 lab var q05_05 		"Has gone hungry because of lack of resources - 2021"
 lab var q05_06a		"Went hungry - Jan 2021"  
 lab var q05_06b		"Went hungry - Feb 2021"  
 lab var q05_06c		"Went hungry - Mar 2021"  
 lab var q05_06d		"Went hungry - Apr 2021"  
 lab var q05_06e		"Went hungry - May 2021"  
 lab var q05_06f		"Went hungry - Jun 2021"  
 lab var q05_06g		"Went hungry - Jul 2021"  
 lab var q05_06h		"Went hungry - Aug 2021"  
 lab var q05_06i		"Went hungry - Sep 2021"  
 lab var q05_06j		"Went hungry - Oct 2021"  
 lab var q05_06k		"Went hungry - Nov 2021"  
 lab var q05_06l		"Went hungry - Dec 2021" 
 
 
 //>>>> 2.5.4. Section ordering
 order q05_01 q05_02a q05_02b q05_02c q05_02d q05_02e q05_02f q05_02g q05_02h ///
 q05_02i q05_02j q05_02k q05_02l q05_03 q05_04a q05_04b q05_04c q05_04d q05_04e ///
 q05_04f q05_04g q05_04h q05_04i q05_04j q05_04k q05_04l q05_05 q05_06a q05_06b ///
 q05_06c q05_06d q05_06e q05_06f q05_06g q05_06h q05_06i q05_06j q05_06k q05_06l, ///
 after(income_21_ot)
 
 rename q05_* foodsec_*
 
 
 
 //>>>>> 2.5.5. Replace conditinal valued answers 
 
 foreach v in foodsec_02a foodsec_02b foodsec_02c foodsec_02d foodsec_02e foodsec_02f foodsec_02g foodsec_02h foodsec_02i foodsec_02j foodsec_02k foodsec_02l {
	replace `v' = 0 if foodsec_01 == 0
 }
 
 foreach v in foodsec_04a foodsec_04b foodsec_04c foodsec_04d foodsec_04e foodsec_04f foodsec_04g foodsec_04h foodsec_04i foodsec_04j foodsec_04k foodsec_04l {
	replace `v' = 0 if foodsec_03 == 0
 }
 
 foreach v in foodsec_06a foodsec_06b foodsec_06c foodsec_06d foodsec_06e foodsec_06f foodsec_06g foodsec_06h foodsec_06i foodsec_06j foodsec_06k foodsec_06l {
	replace `v' = 0 if foodsec_05 == 0
 }
 
 
 
 
 *---------------- 2.6: Delays in household needs

 //>>>> 2.6.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.6.2 Additional variables / transformations 
 
 * simplify to dummies
 rename (q06_13 q06_15 q06_17 q06_19 q06_21 q06_23) (q06_13_det q06_15_det q06_17_det q06_19_det  q06_21_det q06_23_det) 
 gen q06_13 = q06_13_det == 1
 gen q06_15 = q06_15_det == 1
 gen q06_17 = q06_17_det == 1
 gen q06_19 = q06_19_det == 1
 gen q06_21 = q06_21_det == 1
 gen q06_23 = q06_23_det == 1
 
 * Transform YES and No to dummies
 foreach v of varlist q06_00aa q06_00ab q06_00ac q06_00ad q06_00ae q06_01 q06_02a q06_02b q06_02c q06_02d q06_02e q06_02f q06_02g q06_02h q06_02i q06_02j q06_02k q06_02l q06_02z q06_03 q06_04a q06_04b q06_04c q06_04d q06_04e q06_04f q06_04g q06_04h q06_04i q06_04j q06_04k q06_04l q06_04z q06_05 q06_06a q06_06b q06_06c q06_06d q06_06e q06_06f q06_06g q06_06h q06_06i q06_06j q06_06k q06_06l q06_06z q06_07aa q06_07ab q06_07ac q06_07ad q06_07ae q06_07 q06_08a q06_08b q06_08c q06_08d q06_08e q06_08f q06_08g q06_08h q06_08i q06_08j q06_08k q06_08l q06_08z q06_09 q06_10a q06_10b q06_10c q06_10d q06_10e q06_10f q06_10g q06_10h q06_10i q06_10j q06_10k q06_10l q06_10z q06_11 q06_12a q06_12b q06_12c q06_12d q06_12e q06_12f q06_12g q06_12h q06_12i q06_12j q06_12k q06_12l q06_12z q06_13  q06_14a q06_14b q06_14c q06_14d q06_14e q06_14f q06_14g q06_14h q06_14i q06_14j q06_14k q06_14l q06_14z q06_15  q06_16a q06_16b q06_16c q06_16d q06_16e q06_16f q06_16g q06_16h q06_16i q06_16j q06_16k q06_16l q06_16z q06_17 q06_18a q06_18b q06_18c q06_18d q06_18e q06_18f q06_18g q06_18h q06_18i q06_18j q06_18k q06_18l q06_18z q06_19 q06_20a q06_20b q06_20c q06_20d q06_20e q06_20f q06_20g q06_20h q06_20i q06_20j q06_20k q06_20l q06_20z q06_21  q06_22a q06_22b q06_22c q06_22d q06_22e q06_22f q06_22g q06_22h q06_22i q06_22j q06_22k q06_22l q06_22z q06_23  q06_24a	q06_24b	q06_24c	q06_24d	q06_24e	q06_24f	q06_24g	q06_24h	q06_24i	q06_24j	q06_24k	q06_24l	q06_24z {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 //>>>> 2.6.3 Variables relabel
 lab var q06_00aa 		"Interuption of internet, cellphone or electricity - 2019"
 lab var q06_00ab 		"Interuption of internet, cellphone or electricity - 2020"
 lab var q06_00ac 		"Interuption of internet, cellphone or electricity - 2021"
 lab var q06_00ad 		"Interuption of internet, cellphone or electricity - Never"
 lab var q06_00ae 		"Interuption of internet, cellphone or electricity - DNK"		
 lab var q06_01 		"Interuption due to lack of resources - 2019 - internet, cell, electricity"	
 lab var q06_02a 		"Interuption (internet+) money related - Jan 2019"
 lab var q06_02b 		"Interuption (internet+) money related - Feb 2019"
 lab var q06_02c 		"Interuption (internet+) money related - Mar 2019"
 lab var q06_02d 		"Interuption (internet+) money related - Apr 2019"
 lab var q06_02e 		"Interuption (internet+) money related - May 2019"
 lab var q06_02f 		"Interuption (internet+) money related - Jun 2019"
 lab var q06_02g 		"Interuption (internet+) money related - Jul 2019"
 lab var q06_02h 		"Interuption (internet+) money related - Aug 2019"
 lab var q06_02i 		"Interuption (internet+) money related - Sep 2019"
 lab var q06_02j 		"Interuption (internet+) money related - Oct 2019"
 lab var q06_02k 		"Interuption (internet+) money related - Nov 2019"
 lab var q06_02l 		"Interuption (internet+) money related - Dec 2019"
 lab var q06_02z 		"Interuption (internet+) money related - DNK 2019"		
 lab var q06_03 		"Interuption due to lack of resources - 2020 - internet, cell, electricity"	
 lab var q06_04a 		"Interuption (internet+) money related - Jan 2020"	
 lab var q06_04b 		"Interuption (internet+) money related - Feb 2020"	
 lab var q06_04c 		"Interuption (internet+) money related - Mar 2020"	
 lab var q06_04d 		"Interuption (internet+) money related - Apr 2020"	
 lab var q06_04e 		"Interuption (internet+) money related - May 2020"	
 lab var q06_04f 		"Interuption (internet+) money related - Jun 2020"	
 lab var q06_04g 		"Interuption (internet+) money related - Jul 2020"	
 lab var q06_04h 		"Interuption (internet+) money related - Aug 2020"	
 lab var q06_04i 		"Interuption (internet+) money related - Sep 2020"	
 lab var q06_04j 		"Interuption (internet+) money related - Oct 2020"	
 lab var q06_04k 		"Interuption (internet+) money related - Nov 2020"	
 lab var q06_04l 		"Interuption (internet+) money related - Dec 2020"	
 lab var q06_04z 		"Interuption (internet+) money related - DNK 2020"													
 lab var q06_05 		"Interuption due to lack of resources - 2021 - internet, cell, electricity"		
 lab var q06_06a 		"Interuption (internet+) money related - Jan 2021"		
 lab var q06_06b 		"Interuption (internet+) money related - Feb 2021"			
 lab var q06_06c 		"Interuption (internet+) money related - Mar 2021"			
 lab var q06_06d 		"Interuption (internet+) money related - Apr 2021"			
 lab var q06_06e 		"Interuption (internet+) money related - May 2021"			
 lab var q06_06f 		"Interuption (internet+) money related - Jun 2021"			
 lab var q06_06g 		"Interuption (internet+) money related - Jul 2021"			
 lab var q06_06h 		"Interuption (internet+) money related - Aug 2021"			
 lab var q06_06i 		"Interuption (internet+) money related - Sep 2021"			
 lab var q06_06j 		"Interuption (internet+) money related - Oct 2021"			
 lab var q06_06k 		"Interuption (internet+) money related - Nov 2021"			
 lab var q06_06l 		"Interuption (internet+) money related - Dec 2021"			
 lab var q06_06z 		"Interuption (internet+) money related - DNK 2021"					
 lab var q06_07aa 		"Lack of medical attention or medicines - 2019"		
 lab var q06_07ab 		"Lack of medical attention or medicines - 2020"		
 lab var q06_07ac 		"Lack of medical attention or medicines - 2021"		
 lab var q06_07ad 		"Lack of medical attention or medicines - Never"		
 lab var q06_07ae 		"Lack of medical attention or medicines - DNK"				
 lab var q06_07 		"Lack of medical attention due to insuficient resources - 2019"	
 lab var q06_08a 		"Lack of medical attention (-money)- Jan 2019"		
 lab var q06_08b 		"Lack of medical attention (-money) - Feb 2019"		
 lab var q06_08c 		"Lack of medical attention (-money) - Mar 2019"		
 lab var q06_08d 		"Lack of medical attention (-money) - Apr 2019"		
 lab var q06_08e 		"Lack of medical attention (-money) - May 2019"		
 lab var q06_08f 		"Lack of medical attention (-money) - Jun 2019"		
 lab var q06_08g 		"Lack of medical attention (-money) - Jul 2019"		
 lab var q06_08h 		"Lack of medical attention (-money) - Aug 2019"		
 lab var q06_08i 		"Lack of medical attention (-money) - Sep 2019"		
 lab var q06_08j 		"Lack of medical attention (-money) - Oct 2019"		
 lab var q06_08k 		"Lack of medical attention (-money) - Nov 2019"		
 lab var q06_08l 		"Lack of medical attention (-money) - Dec 2019"		
 lab var q06_08z 		"Lack of medical attention (-money) - DNK 2019"				
 lab var q06_09 		"Lack of medical attention due to insuficient resources - 2020"	
 lab var q06_10a 		"Lack of medical attention (-money) - Jan 2020"		
 lab var q06_10b 		"Lack of medical attention (-money) - Feb 2020"		
 lab var q06_10c 		"Lack of medical attention (-money) - Mar 2020"		
 lab var q06_10d 		"Lack of medical attention (-money) - Apr 2020"		
 lab var q06_10e 		"Lack of medical attention (-money) - May 2020"		
 lab var q06_10f 		"Lack of medical attention (-money) - Jun 2020"		
 lab var q06_10g 		"Lack of medical attention (-money) - Jul 2020"		
 lab var q06_10h 		"Lack of medical attention (-money) - Aug 2020"		
 lab var q06_10i 		"Lack of medical attention (-money) - Sep 2020"		
 lab var q06_10j 		"Lack of medical attention (-money) - Oct 2020"		
 lab var q06_10k 		"Lack of medical attention (-money) - Nov 2020"		
 lab var q06_10l 		"Lack of medical attention (-money) - Dec 2020"		
 lab var q06_10z 		"Lack of medical attention (-money) - DNK 2020"				
 lab var q06_11 		"Lack of medical attention due to insuficient resources - 2021"	
 lab var q06_12a 		"Lack of medical attention (-money) - Jan 2021"			
 lab var q06_12b 		"Lack of medical attention (-money) - Feb 2021"			
 lab var q06_12c 		"Lack of medical attention (-money) - Mar 2021"			
 lab var q06_12d 		"Lack of medical attention (-money) - Apr 2021"			
 lab var q06_12e 		"Lack of medical attention (-money) - May 2021"			
 lab var q06_12f 		"Lack of medical attention (-money) - Jun 2021"			
 lab var q06_12g 		"Lack of medical attention (-money) - Jul 2021"			
 lab var q06_12h 		"Lack of medical attention (-money) - Aug 2021"			
 lab var q06_12i 		"Lack of medical attention (-money) - Sep 2021"			
 lab var q06_12j 		"Lack of medical attention (-money) - Oct 2021"			
 lab var q06_12k 		"Lack of medical attention (-money) - Nov 2021"			
 lab var q06_12l 		"Lack of medical attention (-money) - Dec 2021"			
 lab var q06_12z 		"Lack of medical attention (-money) - DNK 2021"					
 lab var q06_13 		"Delayed or no rent payment due to insuficient resources - 2019"	
 lab var q06_13_det 	"Delayed or no rent payment insuficient resources - 2019 (detail)"	
 lab var q06_14a 		"Delayed or no rent payment (-money) - Jan 2019"				
 lab var q06_14b 		"Delayed or no rent payment (-money) - Feb 2019"				
 lab var q06_14c 		"Delayed or no rent payment (-money) - Mar 2019"				
 lab var q06_14d 		"Delayed or no rent payment (-money) - Apr 2019"				
 lab var q06_14e 		"Delayed or no rent payment (-money) - May 2019"				
 lab var q06_14f 		"Delayed or no rent payment (-money) - Jun 2019"				
 lab var q06_14g 		"Delayed or no rent payment (-money) - Jul 2019"				
 lab var q06_14h 		"Delayed or no rent payment (-money) - Aug 2019"				
 lab var q06_14i 		"Delayed or no rent payment (-money) - Sep 2019"				
 lab var q06_14j 		"Delayed or no rent payment (-money) - Oct 2019"				
 lab var q06_14k 		"Delayed or no rent payment (-money) - Nov 2019"				
 lab var q06_14l 		"Delayed or no rent payment (-money) - Dec 2019"				
 lab var q06_14z 		"Delayed or no rent payment (-money) - DNK 2019"						
 lab var q06_15 		"Delayed or no rent payment due to insuficient resources - 2020"	
 lab var q06_15_det 		"Delayed or no rent payment insuficient resources - 2020 (detail)"	
 lab var q06_16a 		"Delayed or no rent payment (-money) - Jan 2020"				
 lab var q06_16b 		"Delayed or no rent payment (-money) - Feb 2020"				
 lab var q06_16c 		"Delayed or no rent payment (-money) - Mar 2020"				
 lab var q06_16d 		"Delayed or no rent payment (-money) - Apr 2020"				
 lab var q06_16e 		"Delayed or no rent payment (-money) - May 2020"				
 lab var q06_16f 		"Delayed or no rent payment (-money) - Jun 2020"				
 lab var q06_16g 		"Delayed or no rent payment (-money) - Jul 2020"				
 lab var q06_16h 		"Delayed or no rent payment (-money) - Aug 2020"				
 lab var q06_16i 		"Delayed or no rent payment (-money) - Sep 2020"				
 lab var q06_16j 		"Delayed or no rent payment (-money) - Oct 2020"				
 lab var q06_16k 		"Delayed or no rent payment (-money) - Nov 2020"				
 lab var q06_16l 		"Delayed or no rent payment (-money) - Dec 2020"				
 lab var q06_16z 		"Delayed or no rent payment (-money) - DNK 2020"					
 lab var q06_17 		"Delayed or no rent payment due to insuficient resources - 2021"	
 lab var q06_17_det		"Delayed or no rent payment insuficient resources - 2021 (detail)"	
 lab var q06_18a 		"Delayed or no rent payment (-money) - Jan 2021"					
 lab var q06_18b 		"Delayed or no rent payment (-money) - Feb 2021"					
 lab var q06_18c 		"Delayed or no rent payment (-money) - Mar 2021"					
 lab var q06_18d 		"Delayed or no rent payment (-money) - Apr 2021"					
 lab var q06_18e 		"Delayed or no rent payment (-money) - May 2021"					
 lab var q06_18f 		"Delayed or no rent payment (-money) - Jun 2021"					
 lab var q06_18g 		"Delayed or no rent payment (-money) - Jul 2021"					
 lab var q06_18h 		"Delayed or no rent payment (-money) - Aug 2021"					
 lab var q06_18i 		"Delayed or no rent payment (-money) - Sep 2021"					
 lab var q06_18j 		"Delayed or no rent payment (-money) - Oct 2021"					
 lab var q06_18k 		"Delayed or no rent payment (-money) - Nov 2021"					
 lab var q06_18l 		"Delayed or no rent payment (-money) - Dec 2021"					
 lab var q06_18z 		"Delayed or no rent payment (-money) - DNK 2021"						
 lab var q06_19 		"Delayed or no debt payment due to insuficient resources - 2019"
 lab var q06_19_det		"Delayed or no debt payment insuficient resources - 2019 (detail)"
 lab var q06_20a 		"Delayed or no debt payment (-money) - Jan 2019"					
 lab var q06_20b 		"Delayed or no debt payment (-money) - Feb 2019"					
 lab var q06_20c 		"Delayed or no debt payment (-money) - Mar 2019"					
 lab var q06_20d 		"Delayed or no debt payment (-money) - Apr 2019"					
 lab var q06_20e 		"Delayed or no debt payment (-money) - May 2019"					
 lab var q06_20f 		"Delayed or no debt payment (-money) - Jun 2019"					
 lab var q06_20g 		"Delayed or no debt payment (-money) - Jul 2019"					
 lab var q06_20h 		"Delayed or no debt payment (-money) - Aug 2019"					
 lab var q06_20i 		"Delayed or no debt payment (-money) - Sep 2019"					
 lab var q06_20j 		"Delayed or no debt payment (-money) - Oct 2019"					
 lab var q06_20k 		"Delayed or no debt payment (-money) - Nov 2019"					
 lab var q06_20l 		"Delayed or no debt payment (-money) - Dec 2019"					
 lab var q06_20z 		"Delayed or no debt payment (-money) - DNK 2019"					
 lab var q06_21 		"Delayed or no debt payment due to insuficient resources - 2020"
 lab var q06_21_det 	"Delayed or no debt payment insuficient resources - 2020 (detail)"
 lab var q06_22a 		"Delayed or no debt payment (-money) - Jan 2020"						
 lab var q06_22b 		"Delayed or no debt payment (-money) - Feb 2020"						
 lab var q06_22c 		"Delayed or no debt payment (-money) - Mar 2020"						
 lab var q06_22d 		"Delayed or no debt payment (-money) - Apr 2020"						
 lab var q06_22e 		"Delayed or no debt payment (-money) - May 2020"						
 lab var q06_22f 		"Delayed or no debt payment (-money) - Jun 2020"						
 lab var q06_22g 		"Delayed or no debt payment (-money) - Jul 2020"						
 lab var q06_22h 		"Delayed or no debt payment (-money) - Aug 2020"						
 lab var q06_22i 		"Delayed or no debt payment (-money) - Sep 2020"						
 lab var q06_22j 		"Delayed or no debt payment (-money) - Oct 2020"						
 lab var q06_22k 		"Delayed or no debt payment (-money) - Nov 2020"						
 lab var q06_22l 		"Delayed or no debt payment (-money) - Dec 2020"						
 lab var q06_22z 		"Delayed or no debt payment (-money) - DNK 2020"						
 lab var q06_23 		"Delayed or no debt payment due to insuficient resources - 2021"
 lab var q06_23_det 	"Delayed or no debt payment insuficient resources - 2021 (detail)"
 lab var q06_24a		"Delayed or no debt payment (-money) - Jan 2021"					
 lab var q06_24b		"Delayed or no debt payment (-money) - Feb 2021"					
 lab var q06_24c		"Delayed or no debt payment (-money) - Mar 2021"					
 lab var q06_24d		"Delayed or no debt payment (-money) - Apr 2021"					
 lab var q06_24e		"Delayed or no debt payment (-money) - May 2021"					
 lab var q06_24f		"Delayed or no debt payment (-money) - Jun 2021"					
 lab var q06_24g		"Delayed or no debt payment (-money) - Jul 2021"					
 lab var q06_24h		"Delayed or no debt payment (-money) - Aug 2021"					
 lab var q06_24i		"Delayed or no debt payment (-money) - Sep 2021"					
 lab var q06_24j		"Delayed or no debt payment (-money) - Oct 2021"					
 lab var q06_24k		"Delayed or no debt payment (-money) - Nov 2021"					
 lab var q06_24l		"Delayed or no debt payment (-money) - Dec 2021"					
 lab var q06_24z		"Delayed or no debt payment (-money) - DNK 2021"
 
 
 //>>>> 2.5.4. Section ordering
 order q06_00aa q06_00ab q06_00ac q06_00ad q06_00ae q06_01 q06_02a q06_02b q06_02c q06_02d q06_02e q06_02f q06_02g q06_02h q06_02i q06_02j q06_02k q06_02l q06_02z q06_03 q06_04a q06_04b q06_04c q06_04d q06_04e q06_04f q06_04g q06_04h q06_04i q06_04j q06_04k q06_04l q06_04z q06_05 q06_06a q06_06b q06_06c q06_06d q06_06e q06_06f q06_06g q06_06h q06_06i q06_06j q06_06k q06_06l q06_06z q06_07aa q06_07ab q06_07ac q06_07ad q06_07ae q06_07 q06_08a q06_08b q06_08c q06_08d q06_08e q06_08f q06_08g q06_08h q06_08i q06_08j q06_08k q06_08l q06_08z q06_09 q06_10a q06_10b q06_10c q06_10d q06_10e q06_10f q06_10g q06_10h q06_10i q06_10j q06_10k q06_10l q06_10z q06_11 q06_12a q06_12b q06_12c q06_12d q06_12e q06_12f q06_12g q06_12h q06_12i q06_12j q06_12k q06_12l q06_12z q06_13 q06_13_det q06_14a q06_14b q06_14c q06_14d q06_14e q06_14f q06_14g q06_14h q06_14i q06_14j q06_14k q06_14l q06_14z q06_15 q06_15_det q06_16a q06_16b q06_16c q06_16d q06_16e q06_16f q06_16g q06_16h q06_16i q06_16j q06_16k q06_16l q06_16z q06_17 q06_17_det	q06_18a q06_18b q06_18c q06_18d q06_18e q06_18f q06_18g q06_18h q06_18i q06_18j q06_18k q06_18l q06_18z q06_19 q06_19_det	q06_20a q06_20b q06_20c q06_20d q06_20e q06_20f q06_20g q06_20h q06_20i q06_20j q06_20k q06_20l q06_20z q06_21 q06_21_det q06_22a q06_22b q06_22c q06_22d q06_22e q06_22f q06_22g q06_22h q06_22i q06_22j q06_22k q06_22l q06_22z q06_23 q06_23_det q06_24a	q06_24b	q06_24c	q06_24d	q06_24e	q06_24f	q06_24g	q06_24h	q06_24i	q06_24j	q06_24k	q06_24l	q06_24z , after(foodsec_06l)
 
 rename q06_* delays_*
 
 //>>>>> 2.5.5. Replace conditinal valued answers 
 
 * Internet
 replace delays_00ae = 0 if delays_00ae == .
 replace delays_00ad = 0 if delays_00ad == . 
 replace delays_00ad = . if delays_00ae == 1 
  
 foreach v in delays_00aa delays_00ab delays_00ac {
	replace `v' = 0 if delays_00ad == 1 
	replace `v' = 0 if `v' == . & delays_00ae == 0 
 }
 
 foreach v in delays_01 delays_02a delays_02b delays_02c delays_02d delays_02e delays_02f delays_02g delays_02h delays_02i delays_02j delays_02k delays_02l delays_02z delays_03 delays_04a delays_04b delays_04c delays_04d delays_04e delays_04f delays_04g delays_04h delays_04i delays_04j delays_04k delays_04l delays_04z delays_05 delays_06a delays_06b delays_06c delays_06d delays_06e delays_06f delays_06g delays_06h delays_06i delays_06j delays_06k delays_06l delays_06z {
	replace `v' = 0 if delays_00ad == 1
	replace `v' = 0 if `v' == . & delays_00ae == 0 
 }
 
 * medical
 replace delays_07ae = 0 if delays_07ae == .
 replace delays_07ad = 0 if delays_07ad == . 
 replace delays_07ad = . if delays_07ae == 1 
  
 foreach v in delays_07aa delays_07ab delays_07ac {
	replace `v' = 0 if delays_07ad == 1 
	replace `v' = 0 if `v' == . & delays_07ae == 0 
 }
 
 foreach v in delays_07 delays_08a delays_08b delays_08c delays_08d delays_08e delays_08f delays_08g delays_08h delays_08i delays_08j delays_08k delays_08l delays_08z delays_09 delays_10a delays_10b delays_10c delays_10d delays_10e delays_10f delays_10g delays_10h delays_10i delays_10j delays_10k delays_10l delays_10z delays_11 delays_12a delays_12b delays_12c delays_12d delays_12e delays_12f delays_12g delays_12h delays_12i delays_12j delays_12k delays_12l delays_12z {
	replace `v' = 0 if delays_07ad == 1
	replace `v' = 0 if `v' == . & delays_07ae == 0 
 }
 
 * Rent
 // 2019
 foreach v in delays_14a delays_14b delays_14c delays_14d delays_14e delays_14f delays_14g delays_14h delays_14i delays_14j delays_14k delays_14l delays_14z {
	replace `v' = 0 if delays_13 == 0 
 }
 
 // 2020
 foreach v in delays_16a delays_16b delays_16c delays_16d delays_16e delays_16f delays_16g delays_16h delays_16i delays_16j delays_16k delays_16l delays_16z {
	replace `v' = 0 if delays_15 == 0 
 }
 
 // 2021
 foreach v in delays_18a delays_18b delays_18c delays_18d delays_18e delays_18f delays_18g delays_18h delays_18i delays_18j delays_18k delays_18l delays_18z {
	replace `v' = 0 if delays_17 == 0 
 }
 
 * Debt
 // 2019
 foreach v in delays_20a delays_20b delays_20c delays_20d delays_20e delays_20f delays_20g delays_20h delays_20i delays_20j delays_20k delays_20l delays_20z {
	replace `v' = 0 if delays_19 == 0 
 }
 
 // 2020
 foreach v in delays_22a delays_22b delays_22c delays_22d delays_22e delays_22f delays_22g delays_22h delays_22i delays_22j delays_22k delays_22l delays_22z {
	replace `v' = 0 if delays_21 == 0 
 }
 
 // 2021
 foreach v in delays_24a delays_24b delays_24c delays_24d delays_24e delays_24f delays_24g delays_24h delays_24i delays_24j delays_24k delays_24l delays_24z {
	replace `v' = 0 if delays_23 == 0 
 }
 
 
 *---------------- 2.7: Household characteristics 
 /* super important note. If they did not move since 2017 they are not asked 
	about the dwelling conditions.  Fill with sisben (T-T) */
 
 //>>>> 2.7.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.7.2 Additional variables / transformations 
 
 * categorical to dummies

 ** housing 
/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace q07_13 = tip_vivienda 		if q07_07 == 2 // add data from sisben
----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_13a = q07_13 == 1 if !missing(q07_13)
 gen q07_13b = q07_13 == 2 if !missing(q07_13)
 gen q07_13c = q07_13 == 3 if !missing(q07_13)
 gen q07_13d = q07_13 == 4 if !missing(q07_13)
 gen q07_13e = q07_13 == 5 if !missing(q07_13)
 
 lab var q07_13a "Housing: house"
 lab var q07_13b "Housing: flat"
 lab var q07_13c "Housing: room"
 lab var q07_13d "Housing: other type"
 lab var q07_13e "Housing: indigenous housing"
 
  ** Walls 
 /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace tip_mat_paredes = 8 		if tip_mat_paredes == 0 
 replace q07_14 = tip_mat_paredes 	if q07_07 == 2 // add data from sisben 
  ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
  
 gen q07_14a = q07_14 == 1 if !missing(q07_14)
 gen q07_14b = q07_14 == 2 if !missing(q07_14)
 gen q07_14c = q07_14 == 3 if !missing(q07_14)
 gen q07_14d = q07_14 == 4 if !missing(q07_14)
 gen q07_14e = q07_14 == 5 if !missing(q07_14)
 gen q07_14f = q07_14 == 6 if !missing(q07_14)
 gen q07_14g = q07_14 == 7 if !missing(q07_14)
 gen q07_14h = q07_14 == 8 if !missing(q07_14)

 lab var q07_14a "Walls: block, brick, park stone, polished and lacquered wood"
 lab var q07_14b "Walls: tapia pisada, adobe"
 lab var q07_14c "Walls: bahareque"
 lab var q07_14d "Walls: prefabricated material"
 lab var q07_14e "Walls: rough wood, board, plank"
 lab var q07_14f "Walls: guadua, cane, matting, other plant material"
 lab var q07_14g "Walls: zinc, cloth, canvas, tarpaulin, cardboard, tin, cans, plastic waste"
 lab var q07_14h "Walls: without walls"

  
  ** floors 
/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace tip_mat_pisos = 97 		if tip_mat_pisos == 6
 replace q07_15 = tip_mat_pisos 	if q07_07 == 2 // add data from sisben 
----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_15a = q07_15 == 1	if !missing(q07_15)
 gen q07_15b = q07_15 == 2	if !missing(q07_15)
 gen q07_15c = q07_15 == 3	if !missing(q07_15)
 gen q07_15d = q07_15 == 4	if !missing(q07_15)
 gen q07_15e = q07_15 == 5	if !missing(q07_15)
 gen q07_15f = q07_15 == 97	if !missing(q07_15)
 
 lab var q07_15a  "Floor: carpet or rug, marble, polished or lacquered wood" 
 lab var q07_15b  "Floor: tile, vinyl, tile, brick, brick" 
 lab var q07_15c  "Floor: cement, gravel" 
 lab var q07_15d  "Floor: rough wood, distressed wood, board, plank, plank" 
 lab var q07_15e  "Floor: earth or sand" 
 lab var q07_15f  "Floor: other" 
 
 ** access to services
 /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace q07_16a = ind_tiene_energia 			if q07_07 == 2 // add data from sisben 
 replace q07_16b = ind_tiene_alcantarillado 	if q07_07 == 2 // add data from sisben 
 replace q07_16c = ind_tiene_gas  				if q07_07 == 2 // add data from sisben 
 replace q07_16d = ind_tiene_recoleccion  		if q07_07 == 2 // add data from sisben 
 replace q07_16e = ind_tiene_acueducto  		if q07_07 == 2 // add data from sisben 
 
 ** number of rooms and household in dwelling
 replace q07_17  =  num_cuartos_vivienda		if q07_07 == 2 // add data from sisben 
 replace q07_18  =  num_hogares_vivienda		if q07_07 == 2 // add data from sisben 
 
  ** ownership 
 *replace q07_19 = tip_ocupa_vivienda			if q07_07 == 1 // add data from sisben  (we are missing this)
 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_19a = q07_19 == 1 if !missing(q07_19)
 gen q07_19b = q07_19 == 2 if !missing(q07_19)
 gen q07_19c = q07_19 == 3 if !missing(q07_19)
 gen q07_19d = q07_19 == 4 if !missing(q07_19)
 gen q07_19e = q07_19 == 5 if !missing(q07_19)
 
 gen q07_19own = (q07_19 == 2 | q07_19 == 3)  
 
 lab var q07_19a 	"Property: leased or sublet"
 lab var q07_19b 	"Property: Owned, still paying"
 lab var q07_19c 	"Property: own, fully paid for"
 lab var q07_19d 	"Property: with landlord's permission"
 lab var q07_19e 	"Property: untitled possession, de facto occupier"
 lab var q07_19own "Property: Own (paid or still paying)"
 
/*----------------------------------------------------------------------
	-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 
 ** num cuartos 
 replace q07_20 = num_cuartos_exclusivos			if q07_07 == 2 // add data from sisben   
 replace q07_21 = num_cuartos_dormir				if q07_07 == 2 // add data from sisben   
 replace q07_22 = num_cuartos_unicos_dormir			if q07_07 == 2 // add data from sisben   
----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 
 ** WC 
  * type

    /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace q07_23 = tip_sanitario			if q07_07 == 2 // add data from sisben  

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_23a = q07_23 == 1 if !missing(q07_23)
 gen q07_23b = q07_23 == 2 if !missing(q07_23)
 gen q07_23c = q07_23 == 3 if !missing(q07_23)
 gen q07_23d = q07_23 == 4 if !missing(q07_23)
 gen q07_23e = q07_23 == 5 if !missing(q07_23)
 
 lab var q07_23a "WC: with sewer connection"
 lab var q07_23b "WC: with septic connection"
 lab var q07_23c "WC: no connection to sewerage or septic tank"
 lab var q07_23d "WC: latrine, low tide"
 lab var q07_23e "WC: no toilet"

  
  * location 
    /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace tip_ubi_sanitario = . if tip_ubi_sanitario == 9
 replace q07_24 = tip_ubi_sanitario			if q07_07 == 2 // add data from sisben  

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_24a = q07_24 == 1 if !missing(q07_24)
 gen q07_24b = q07_24 == 2 if !missing(q07_24)
 
 lab var q07_24a "WC location: inside the dwelling"
 lab var q07_24b "WC location: outside the dwelling"

 
  * exclusivity
    /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace tip_uso_sanitario = . if tip_ubi_sanitario == 9
 replace q07_25 = tip_uso_sanitario			if q07_07 == 2 // add data from sisben  

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_25a = q07_25 == 1 if !missing(q07_25)
 gen q07_25b = q07_25 == 2 if !missing(q07_25)
 gen q07_25c = q07_25 == 3 if !missing(q07_25)
 
 lab var q07_25a "WC excl.: exclusively used by persons in this household"
 lab var q07_25b "WC excl.: shared with households in the same dwelling"
 lab var q07_25c "WC excl.: shared with households in other dwellings"

 
 ** water 
  *source 
  /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace q07_26 = tip_origen_agua			if q07_07 == 2 // add data from sisben  

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_26a = q07_26 == 1 if !missing(q07_26)
 gen q07_26b = q07_26 == 2 if !missing(q07_26)
 gen q07_26c = q07_26 == 3 if !missing(q07_26)
 gen q07_26d = q07_26 == 4 if !missing(q07_26)
 gen q07_26e = q07_26 == 5 if !missing(q07_26)
 gen q07_26f = q07_26 == 6 if !missing(q07_26)
 gen q07_26g = q07_26 == 7 if !missing(q07_26)
 gen q07_26h = q07_26 == 8 if !missing(q07_26)
 gen q07_26i = q07_26 == 9 if !missing(q07_26)
  
 lab var q07_26a "Water source: aqueduct"
 lab var q07_26b "Water source: well with pump"
 lab var q07_26c "Water source: well without pump, water well"
 lab var q07_26d "Water source: rainwater"
 lab var q07_26e "Water source: river, stream, spring or source"
 lab var q07_26f "Water source: public well"
 lab var q07_26g "Water source: water tank"
 lab var q07_26h "Water source: water carrier"
 lab var q07_26i "Water source: bottled or bagged water"

  * 27h/7d
  /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace ind_agua_llega_7dias = . if ind_agua_llega_7dias == 9
 replace water_ndays = . if water_ndays == 9
 replace ind_agua_llega_24horas = . if ind_agua_llega_24horas == 9
 replace ind_agua_llega_24horas = . if ind_agua_llega_24horas == 9
 
 replace q07_27 = 	ind_agua_llega_7dias	if q07_07 == 2
 replace q07_28 = 	water_ndays				if q07_07 == 2
 replace q07_29 = 	ind_agua_llega_24horas	if q07_07 == 2
 replace q07_30 = 	water_nhours			if q07_07 == 2
 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
  
  /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
  * treatment
 replace q07_31 = 	tip_uso_agua_beber		if q07_07 == 2 // add data from sisben 

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_31a = q07_31 == 1 if !missing(q07_31)
 gen q07_31b = q07_31 == 2 if !missing(q07_31)
 gen q07_31c = q07_31 == 3 if !missing(q07_31)
 gen q07_31d = q07_31 == 4 if !missing(q07_31)
 gen q07_31e = q07_31 == 5 if !missing(q07_31)
 gen q07_31f = q07_31 == 6 if !missing(q07_31)
 
 lab var q07_31a "Water treat: use it, how do they get it"
 lab var q07_31b "Water treat: Boil it"
 lab var q07_31c "Water treat: do you chlorinate it"
 lab var q07_31d "Water treat: do you use filters"
 lab var q07_31e "Water treat: Decant it or use natural filters"
 lab var q07_31f "Water treat: Do you buy bottled or bagged water"

 
 ** waste
 /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace q07_32 = tip_elimina_basura 	if q07_07 == 2 // add data from sisben  
 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_32a = q07_32 == 1 if !missing(q07_32)
 gen q07_32b = q07_32 == 2 if !missing(q07_32)
 gen q07_32c = q07_32 == 3 if !missing(q07_32)
 gen q07_32d = q07_32 == 4 if !missing(q07_32)
 gen q07_32e = q07_32 == 5 if !missing(q07_32)
 gen q07_32f = q07_32 == 6 if !missing(q07_32)
 gen q07_32g = q07_32 == 7 if !missing(q07_32)
 
 lab var q07_32a  "Waste: picked up by the sanitation services"
 lab var q07_32b  "Waste: buried"
 lab var q07_32c  "Waste: burned"
 lab var q07_32d  "Waste: dumped in a yard, lot, ditch or vacant lot"
 lab var q07_32e  "Waste: dumped in a river, stream, pipe or lagoon"
 lab var q07_32f  "Waste: it is picked up by an informal service (fox, cart)"
 lab var q07_32g  "Waste: it is disposed of in another way"

 
 ** cooking 
 
  * kitchen
/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace q07_33 = ind_tiene_cocina 	if q07_07 == 2 // add data from sisben  
 
  * place
 replace q07_34 = tip_prepara_alimentos 	if q07_07 == 2 // add data from sisben  
 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_34a = q07_34 == 1 if !missing(q07_34)
 gen q07_34b = q07_34 == 2 if !missing(q07_34)
 gen q07_34c = q07_34 == 3 if !missing(q07_34)
 gen q07_34d = q07_34 == 4 if !missing(q07_34)
 gen q07_34e = q07_34 == 5 if !missing(q07_34)
 
 lab var q07_34a "Cooking: room used only for cooking"
 lab var q07_34b "Cooking: room used also for sleeping"
 lab var q07_34c "Cooking: living room, a dining room"
 lab var q07_34d "Cooking: courtyard, a corridor, a bower, outdoors"
 lab var q07_34e "Cooking: nowhere, no food preparation"

 
  * exclusivity 
  /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace tip_uso_cocina = . if tip_uso_cocina == 9
 replace q07_35 =  tip_uso_cocina	if q07_07 == 2 // add data from sisben  

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_35a = q07_35 == 1 if !missing(q07_35)
 gen q07_35b = q07_35 == 2 if !missing(q07_35)
 gen q07_35c = q07_35 == 3 if !missing(q07_35)
 
 lab var q07_35a  "Cooking place: exclusively used by persons in this household"
 lab var q07_35b  "Cooking place: shared with households in the same dwelling"
 lab var q07_35c  "Cooking place: shared with households in other dwellings"
 
  * fuel 
  /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
 replace tip_energia_cocina = . if tip_energia_cocina == 9
 replace q07_36 = tip_energia_cocina 	if q07_07 == 2 // add data from sisben  

 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/
 
 gen q07_36a = q07_36 == 1 if !missing(q07_36) 
 gen q07_36b = q07_36 == 2 if !missing(q07_36)
 gen q07_36c = q07_36 == 3 if !missing(q07_36)
 gen q07_36d = q07_36 == 4 if !missing(q07_36)
 gen q07_36e = q07_36 == 5 if !missing(q07_36)
 gen q07_36f = q07_36 == 6 if !missing(q07_36)
 gen q07_36g = q07_36 == 7 if !missing(q07_36)
 
 lab var q07_36a "Cooking fuel: electricity"
 lab var q07_36b "Cooking fuel: household natural gas"
 lab var q07_36c "Cooking fuel: propane gas (in cylinder or pipette)"
 lab var q07_36d "Cooking fuel: petroleum, gasoline, coal, alcohol, alcohol, cooking oil"
 lab var q07_36e "Cooking fuel: mineral coal"
 lab var q07_36f "Cooking fuel: waste material, firewood, charcoal, wood charcoal"
 lab var q07_36g "Cooking fuel: none (no cooking)"

 
 
 * Transform YES and No to dummies
 foreach v of varlist q07_01 q07_02a q07_02b q07_02c q07_07 q07_16a q07_16b q07_16c q07_16d q07_16e q07_27 q07_29 q07_33{
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 //>>>> 2.7.3 Variables relabel
 lab var q07_01 		"Internet access in the HH"	
 lab var q07_02a 		"Internet: land connection"	
 lab var q07_02b 		"Internet: mobile plan prepaid"	
 lab var q07_02c 		"Internet: mobile plan postpaid"	
 lab var q07_03 		"Internet coneection since year"	
 lab var q07_04a 		"Month of move-in to residence"	
 lab var q07_04b 		"Year of move-in to residence"	
 *lab var q07_05 		Not provided
 lab var q07_06 		"Municipality of residence"		
 lab var q07_07 		"Moved since 1st Jan, 2017"	
 lab var q07_08 		"Times moved since 1st Jan, 2019"	
 lab var q07_13 		"Dwelling type"	
 lab var q07_14 		"Wall material"	
 lab var q07_15 		"Floor material"	
 lab var q07_16a 		"Utilities: Electric"
 lab var q07_16b 		"Utilities: Sewerage"
 lab var q07_16c 		"Utilities: Natural gas"
 lab var q07_16d 		"Utilities: Waste collection"
 lab var q07_16e 		"Utilities: Aqueduct"
 lab var q07_17			"Number of rooms in dwelling" 
 lab var q07_18			"Number of households in dwelling" 
 lab var q07_19			"Ownership, tenat status" 
 lab var q07_20			"Rooms of exclusive use" 
 lab var q07_21			"Bedrooms (rooms used to sleep)" 
 lab var q07_22			"Bedrooms (only used to sleep)"
 lab var q07_23			"WC type"
 lab var q07_24			"Location of the WC"
 lab var q07_25			"WC's exclusivity'"
 lab var q07_26			"Drinking water source"
 lab var q07_27			"Water 7-days a week"
 lab var q07_28			"Number of days with running water"
 lab var q07_29			"Water supply is 24h"
 lab var q07_30			"Number of water supply"
 lab var q07_31			"Drinking water treatment"
 lab var q07_32			"Waste disposal method"
 lab var q07_33			"Dwelling has a kitchen"
 lab var q07_34			"Place for cooking"
 lab var q07_35			"Cooking place exclusivity"
 lab var q07_36			"Cooking fuel"
 
 //>>>> 2.7.4. Section ordering
 order q07_01 q07_02a q07_02b q07_02c q07_03 q07_04a q07_04b  q07_05 q07_06 q07_07 q07_08 q07_13* q07_14* q07_15* q07_16a q07_16b q07_16c q07_16d q07_16e q07_17 q07_18 q07_19* q07_20 q07_21 q07_22 q07_23* q07_24* q07_25* q07_26* q07_27 q07_28 q07_29 q07_30 q07_31* q07_32* q07_33 q07_34* q07_35* q07_36*, after(delays_24z)

 rename q07_* housing_*
 
 *---------------- 2.8: Assets 
 
 /* IMPORTANT NOTICE:
	This is a different dataset and is prepared and joint in do-file D4
	- Run D4 after fully running D3
 */
 
 *---------------- 2.9: Household losses 
 
 /* IMPORTANT NOTICE:
	This is a different dataset and is prepared and joint in do-file D4
	- Run D4 after fully running D3
 */
 
 *---------------- 2.10: Access to credit 
 //>>>> 2.10.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.10.2 Additional variables / transformations 
 
 * simplify to dummies
 foreach k in "13" "15" "17" {
 	rename q10_`k' q10_`k'_det 
	gen q10_`k' = q10_`k'_det == 1 if !missing(q10_`k'_det)
	replace q10_`k' = . if q10_`k'_det == 3 | q10_`k'_det == 4
 }
 
 * Transform YES and No to dummies
 foreach v of varlist q10_01a q10_01b q10_01c q10_01d q10_01e q10_02 q10_03a q10_03b q10_03c q10_03d q10_03e q10_03f q10_03g q10_03h q10_03i q10_03j q10_03k q10_03l q10_03z q10_04 q10_04aa q10_04ab q10_04ac q10_04ad q10_04ae q10_04af q10_04ag q10_04ah q10_04ai q10_04aj q10_04ak q10_04al q10_04az q10_05 q10_06a q10_06b q10_06c q10_06d q10_06e q10_06f q10_06g q10_06h q10_06i q10_06j q10_06k q10_06l q10_06z q10_07 q10_07aa q10_07ab q10_07ac q10_07ad q10_07ae q10_07af q10_07ag q10_07ah q10_07ai q10_07aj q10_07ak q10_07al q10_07az q10_08 q10_09a q10_09b q10_09c q10_09d q10_09e q10_09f q10_09g q10_09h q10_09i q10_09j q10_09k q10_09l q10_09z q10_10 q10_10aa q10_10ab q10_10ac q10_10ad q10_10ae q10_10af q10_10ag q10_10ah q10_10ai q10_10aj q10_10ak q10_10al q10_10az q10_11 q10_12 q10_13 q10_14a q10_14b q10_14c q10_14d q10_14e q10_14f q10_14g q10_14h q10_14i q10_14j q10_14k q10_14l q10_14z q10_15 q10_16a q10_16b q10_16c q10_16d q10_16e q10_16f q10_16g q10_16h q10_16i q10_16j q10_16k q10_16l q10_16z q10_17 q10_18a q10_18b q10_18c q10_18d q10_18e q10_18f q10_18g q10_18h q10_18i q10_18j q10_18k q10_18l q10_18z  {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 //>>>> 2.10.3 Variables relabel
 lab var q10_01a 			"Applied for a formal credit - 2019" 
 lab var q10_01b 			"Applied for a formal credit - 2020" 
 lab var q10_01c 			"Applied for a formal credit - 2021" 
 lab var q10_01d 			"Applied for a formal credit - None" 
 lab var q10_01e 			"Applied for a formal credit - DNK" 
 lab var q10_02				"Applied for a formal credit in 2019"			
 lab var q10_03a 			"Applied for a formal credit - Jan 2019"						
 lab var q10_03b 			"Applied for a formal credit - Feb 2019"						
 lab var q10_03c 			"Applied for a formal credit - Mar 2019"						
 lab var q10_03d 			"Applied for a formal credit - Apr 2019"						
 lab var q10_03e 			"Applied for a formal credit - May 2019"						
 lab var q10_03f 			"Applied for a formal credit - Jun 2019"						
 lab var q10_03g 			"Applied for a formal credit - Jul 2019"						
 lab var q10_03h 			"Applied for a formal credit - Aug 2019"						
 lab var q10_03i 			"Applied for a formal credit - Sep 2019"						
 lab var q10_03j 			"Applied for a formal credit - Oct 2019"						
 lab var q10_03k 			"Applied for a formal credit - Nov 2019"						
 lab var q10_03l 			"Applied for a formal credit - Dec 2019"						
 lab var q10_03z 			"Applied for a formal credit - DNK 2019"						
 lab var q10_04				"Applied to credit and got approved - 2019"
 lab var q10_04aa			"Credit approved - Jan 2019"
 lab var q10_04ab			"Credit approved - Feb 2019"
 lab var q10_04ac			"Credit approved - Mar 2019"
 lab var q10_04ad			"Credit approved - Apr 2019"
 lab var q10_04ae			"Credit approved - May 2019"
 lab var q10_04af			"Credit approved - Jun 2019"
 lab var q10_04ag			"Credit approved - Jul 2019"
 lab var q10_04ah			"Credit approved - Aug 2019"
 lab var q10_04ai			"Credit approved - Sep 2019"
 lab var q10_04aj			"Credit approved - Oct 2019"
 lab var q10_04ak			"Credit approved - Nov 2019"
 lab var q10_04al			"Credit approved - Dec 2019"
 lab var q10_04az			"Credit approved - DNK 2019"
 lab var q10_05				"Applied for a formal credit in 2020"
 lab var q10_06a			"Applied for a formal credit- Jan 2020"
 lab var q10_06b			"Applied for a formal credit- Feb 2020"
 lab var q10_06c			"Applied for a formal credit- Mar 2020"
 lab var q10_06d			"Applied for a formal credit- Apr 2020"
 lab var q10_06e			"Applied for a formal credit- May 2020"
 lab var q10_06f			"Applied for a formal credit- Jun 2020"
 lab var q10_06g			"Applied for a formal credit- Jul 2020"
 lab var q10_06h			"Applied for a formal credit- Aug 2020"
 lab var q10_06i			"Applied for a formal credit- Sep 2020"
 lab var q10_06j			"Applied for a formal credit- Oct 2020"
 lab var q10_06k			"Applied for a formal credit- Nov 2020"
 lab var q10_06l			"Applied for a formal credit- Dec 2020"
 lab var q10_06z			"Applied for a formal credit- DNK 2020"
 lab var q10_07				"Applied to credit and got approved - 2020"
 lab var q10_07aa			"Credit approved - Jan 2020"
 lab var q10_07ab			"Credit approved - Feb 2020"
 lab var q10_07ac			"Credit approved - Mar 2020"
 lab var q10_07ad			"Credit approved - Apr 2020"
 lab var q10_07ae			"Credit approved - May 2020"
 lab var q10_07af			"Credit approved - Jun 2020"
 lab var q10_07ag			"Credit approved - Jul 2020"
 lab var q10_07ah			"Credit approved - Aug 2020"
 lab var q10_07ai			"Credit approved - Sep 2020"
 lab var q10_07aj			"Credit approved - Oct 2020"
 lab var q10_07ak			"Credit approved - Nov 2020"
 lab var q10_07al			"Credit approved - Dec 2020"
 lab var q10_07az			"Credit approved - DNK 2020"
 lab var q10_08				"Applied for a formal credit in 2021"			
 lab var q10_09a			"Applied for a formal credit - Jan 2021"		
 lab var q10_09b			"Applied for a formal credit - Feb 2021"		
 lab var q10_09c			"Applied for a formal credit - Mar 2021"		
 lab var q10_09d			"Applied for a formal credit - Apr 2021"		
 lab var q10_09e			"Applied for a formal credit - May 2021"		
 lab var q10_09f			"Applied for a formal credit - Jun 2021"		
 lab var q10_09g			"Applied for a formal credit - Jul 2021"		
 lab var q10_09h			"Applied for a formal credit - Aug 2021"		
 lab var q10_09i			"Applied for a formal credit - Sep 2021"		
 lab var q10_09j			"Applied for a formal credit - Oct 2021"		
 lab var q10_09k			"Applied for a formal credit - Nov 2021"		
 lab var q10_09l			"Applied for a formal credit - Dec 2021"		
 lab var q10_09z			"Applied for a formal credit - DNK 2021"		
 lab var q10_10				"Applied to credit and got approved - 2021"
 lab var q10_10aa			"Credit approved - Jan 2021"
 lab var q10_10ab           "Credit approved - Feb 2021"
 lab var q10_10ac           "Credit approved - Mar 2021"
 lab var q10_10ad           "Credit approved - Apr 2021"
 lab var q10_10ae           "Credit approved - May 2021"
 lab var q10_10af           "Credit approved - Jun 2021"
 lab var q10_10ag           "Credit approved - Jul 2021"
 lab var q10_10ah           "Credit approved - Aug 2021"
 lab var q10_10ai           "Credit approved - Sep 2021"
 lab var q10_10aj           "Credit approved - Oct 2021"
 lab var q10_10ak           "Credit approved - Nov 2021"
 lab var q10_10al           "Credit approved - Dec 2021"
 lab var q10_10az           "Credit approved - DNK 2021"
 lab var q10_11				"Active credit during 1st Jan 2019, onwards"
 lab var q10_12				"Meet all regular credit payments since 1st Jan 2019"
 lab var q10_13				"Meet credit payments - 2019"
 lab var q10_14a			"Did not meet credit payments - Jan 2019"
 lab var q10_14b			"Did not meet credit payments - Feb 2019"
 lab var q10_14c			"Did not meet credit payments - Mar 2019"
 lab var q10_14d			"Did not meet credit payments - Apr 2019"
 lab var q10_14e			"Did not meet credit payments - May 2019"
 lab var q10_14f			"Did not meet credit payments - Jun 2019"
 lab var q10_14g			"Did not meet credit payments - Jul 2019"
 lab var q10_14h			"Did not meet credit payments - Aug 2019"
 lab var q10_14i			"Did not meet credit payments - Sep 2019"
 lab var q10_14j			"Did not meet credit payments - Oct 2019"
 lab var q10_14k			"Did not meet credit payments - Nov 2019"
 lab var q10_14l			"Did not meet credit payments - Dec 2019"
 lab var q10_14z			"Did not meet credit payments - DNK 2019"
 lab var q10_15				"Meet credit payments - 2020"
 lab var q10_16a			"Did not meet credit payments - Jan 2020"
 lab var q10_16b            "Did not meet credit payments - Feb 2020"
 lab var q10_16c            "Did not meet credit payments - Mar 2020"
 lab var q10_16d            "Did not meet credit payments - Apr 2020"
 lab var q10_16e            "Did not meet credit payments - May 2020"
 lab var q10_16f            "Did not meet credit payments - Jun 2020"
 lab var q10_16g            "Did not meet credit payments - Jul 2020"
 lab var q10_16h            "Did not meet credit payments - Aug 2020"
 lab var q10_16i            "Did not meet credit payments - Sep 2020"
 lab var q10_16j            "Did not meet credit payments - Oct 2020"
 lab var q10_16k            "Did not meet credit payments - Nov 2020"
 lab var q10_16l            "Did not meet credit payments - Dec 2020"
 lab var q10_16z            "Did not meet credit payments - DNK 2020"
 lab var q10_17				"Meet credit payments - 2021"
 lab var q10_18a            "Did not meet credit payments - Jan 2021"
 lab var q10_18b            "Did not meet credit payments - Feb 2021"
 lab var q10_18c            "Did not meet credit payments - Mar 2021"
 lab var q10_18d            "Did not meet credit payments - Apr 2021"
 lab var q10_18e            "Did not meet credit payments - May 2021"
 lab var q10_18f            "Did not meet credit payments - Jun 2021"
 lab var q10_18g            "Did not meet credit payments - Jul 2021"
 lab var q10_18h            "Did not meet credit payments - Aug 2021"
 lab var q10_18i            "Did not meet credit payments - Sep 2021"
 lab var q10_18j            "Did not meet credit payments - Oct 2021"
 lab var q10_18k            "Did not meet credit payments - Nov 2021"
 lab var q10_18l            "Did not meet credit payments - Dec 2021"
 lab var q10_18z            "Did not meet credit payments - DNK 2021"

 //>>>> 2.10.4. Section ordering
 order q10_01a q10_01b q10_01c q10_01d q10_01e q10_02 q10_03a q10_03b q10_03c q10_03d q10_03e q10_03f q10_03g q10_03h q10_03i q10_03j q10_03k q10_03l q10_03z q10_04 q10_04aa q10_04ab q10_04ac q10_04ad q10_04ae q10_04af q10_04ag q10_04ah q10_04ai q10_04aj q10_04ak q10_04al q10_04az q10_05 q10_06a q10_06b q10_06c q10_06d q10_06e q10_06f q10_06g q10_06h q10_06i q10_06j q10_06k q10_06l q10_06z q10_07 q10_07aa q10_07ab q10_07ac q10_07ad q10_07ae q10_07af q10_07ag q10_07ah q10_07ai q10_07aj q10_07ak q10_07al q10_07az q10_08 q10_09a q10_09b q10_09c q10_09d q10_09e q10_09f q10_09g q10_09h q10_09i q10_09j q10_09k q10_09l q10_09z q10_10 q10_10aa q10_10ab q10_10ac q10_10ad q10_10ae q10_10af q10_10ag q10_10ah q10_10ai q10_10aj q10_10ak q10_10al q10_10az q10_11 q10_12 q10_13* q10_14a q10_14b q10_14c q10_14d q10_14e q10_14f q10_14g q10_14h q10_14i q10_14j q10_14k q10_14l q10_14z q10_15* q10_16a q10_16b q10_16c q10_16d q10_16e q10_16f q10_16g q10_16h q10_16i q10_16j q10_16k q10_16l q10_16z q10_17* q10_18a q10_18b q10_18c q10_18d q10_18e q10_18f q10_18g q10_18h q10_18i q10_18j q10_18k q10_18l q10_18z , after(housing_36g)

 rename q10_* credit_*
 
 //>>>>> Replace conditinal valued answers 
 
 * applied
 replace credit_01e = 0 if credit_01e == .
 replace credit_01d = 0 if credit_01d == . 
 replace credit_01d = . if credit_01e == 1 
  
 foreach v in credit_01a credit_01b credit_01c {
	replace `v' = 0 if credit_01d == 1 
	replace `v' = 0 if `v' == . & credit_01e == 0 
 }
 
 // jump to 11 if DNK or NO
 foreach v in credit_02 credit_03a credit_03b credit_03c credit_03d credit_03e credit_03f credit_03g credit_03h credit_03i credit_03j credit_03k credit_03l credit_03z credit_04 credit_04aa credit_04ab credit_04ac credit_04ad credit_04ae credit_04af credit_04ag credit_04ah credit_04ai credit_04aj credit_04ak credit_04al credit_04az credit_05 credit_06a credit_06b credit_06c credit_06d credit_06e credit_06f credit_06g credit_06h credit_06i credit_06j credit_06k credit_06l credit_06z credit_07 credit_07aa credit_07ab credit_07ac credit_07ad credit_07ae credit_07af credit_07ag credit_07ah credit_07ai credit_07aj credit_07ak credit_07al credit_07az credit_08 credit_09a credit_09b credit_09c credit_09d credit_09e credit_09f credit_09g credit_09h credit_09i credit_09j credit_09k credit_09l credit_09z credit_10 credit_10aa credit_10ab credit_10ac credit_10ad credit_10ae credit_10af credit_10ag credit_10ah credit_10ai credit_10aj credit_10ak credit_10al credit_10az {
	replace `v' = 0 if credit_01d == 1 
	replace `v' = 0 if `v' == . & credit_01e == 0 
 }
 
 
 *replace credit_11 = 0 if credit_12 == 1
 
 foreach v in credit_13 credit_15 credit_17 {
	*replace `v' = 0 if credit_11 == 0
	replace `v' = 1 if credit_12 == 1
 }
 
 foreach v in credit_14a credit_14b credit_14c credit_14d credit_14e credit_14f credit_14g credit_14h credit_14i credit_14j credit_14k credit_14l credit_14z credit_16a credit_16b credit_16c credit_16d credit_16e credit_16f credit_16g credit_16h credit_16i credit_16j credit_16k credit_16l credit_16z credit_18a credit_18b credit_18c credit_18d credit_18e credit_18f credit_18g credit_18h credit_18i credit_18j credit_18k credit_18l credit_18z {
	*replace `v' = 0 if credit_11 == 0
	replace `v' = 0 if credit_12 == 1
	replace `v' = 0 if `v' == . & credit_12 == 0
 }
  
 
 *---------------- 2.11: Other finances support
 //>>>> 2.11.1. Rubbish cleaning 
 * variales w/out infomation 
 
 //>>>> 2.11.2 Additional variables / transformations 
 
 * simplify to dummies
 foreach k in "01" "03" "05" {
 	rename q11_`k' q11_`k'_det 
	gen q11_`k' = q11_`k'_det == 1 if !missing(q11_`k'_det)
 }
 
 * Transform YES and No to dummies
 foreach v of varlist q11_01 q11_02a q11_02b q11_02c q11_02d q11_02e q11_02f q11_02g q11_02h q11_02i q11_02j q11_02k q11_02l q11_02z q11_03 q11_04a q11_04b q11_04c q11_04d q11_04e q11_04f q11_04g q11_04h q11_04i q11_04j q11_04k q11_04l q11_04z q11_05 q11_06a q11_06b q11_06c q11_06d q11_06e q11_06f q11_06g q11_06h q11_06i q11_06j q11_06k q11_06l q11_06z q11_07a q11_07b q11_07c q11_07d q11_07e q11_08 q11_09a q11_09b q11_09c q11_09d q11_09e q11_09f q11_09g q11_09h q11_09i q11_09j q11_09k q11_09l q11_09z q11_10 q11_11a q11_11b q11_11c q11_11d q11_11e q11_11f q11_11g q11_11h q11_11i q11_11j q11_11k q11_11l q11_11z q11_12 q11_13a q11_13b q11_13c q11_13d q11_13e q11_13f q11_13g q11_13h q11_13i q11_13j q11_13k q11_13l q11_13z q11_14 q11_15a q11_15b q11_15c q11_15d q11_15e q11_15f q11_15g q11_15h q11_15i q11_15j q11_15k q11_15l q11_15z q11_16 q11_17a q11_17b q11_17c q11_17d q11_17e q11_17f q11_17g q11_17h q11_17i q11_17j q11_17k q11_17l q11_17z q11_18  q11_19a q11_19b q11_19c q11_19d q11_19e q11_19f q11_19g q11_19h q11_19i q11_19j q11_19k q11_19l q11_19z q11_20a q11_20b q11_20c q11_20d q11_20e q11_21 q11_22a q11_22b q11_22c q11_22d q11_22e q11_22f q11_22g q11_22h q11_22i q11_22j q11_22k q11_22l q11_22z q11_22aa  q11_22bba q11_22bbb q11_22bbc q11_22bbd q11_22bbe q11_22bbf q11_22bbg q11_22bbh q11_22bbi q11_22bbj q11_22bbk q11_22bbl q11_22bbz q11_23  q11_24a q11_24b q11_24c q11_24d q11_24e q11_24f q11_24g q11_24h q11_24i q11_24j q11_24k q11_24l q11_24z q11_24aa  q11_24bba q11_24bbb q11_24bbc q11_24bbd q11_24bbe q11_24bbf q11_24bbg q11_24bbh q11_24bbi q11_24bbj q11_24bbk q11_24bbl q11_24bbz q11_25  q11_26a q11_26b q11_26c q11_26d q11_26e q11_26f q11_26g q11_26h q11_26i q11_26j q11_26k q11_26l q11_26z q11_26aa  q11_26bba q11_26bbb q11_26bbc q11_26bbd q11_26bbe q11_26bbf q11_26bbg q11_26bbh q11_26bbi q11_26bbj q11_26bbk q11_26bbl q11_26bbz q11_27a q11_27b q11_27c q11_27d q11_27e q11_28  q11_29a q11_29b q11_29c q11_29d q11_29e q11_29f q11_29g q11_29h q11_29i q11_29j q11_29k q11_29l q11_29z q11_30  q11_31a q11_31b q11_31c q11_31d q11_31e q11_31f q11_31g q11_31h q11_31i q11_31j q11_31k q11_31l q11_31z q11_32  q11_33a q11_33b q11_33c q11_33d q11_33e q11_33f q11_33g q11_33h q11_33i q11_33j q11_33k q11_33l q11_33z {
 	replace `v' = 0 if `v' == 2
	lab define l`v' 1 "Yes" 0 "No" , modify
	lab values `v' l`v'
	replace `v' = . if `v' == 98
 }
 
 //>>>> 2.11.3 Variables relabel
 lab var q11_01				"Used savings to meet any of the HH basic needs - 2019"
 lab var q11_01_det			"Used savings to meet any of the HH basic needs - 2019 (detail)"
 lab var q11_02a			"Used savings to meet basic needs - Jan 2019"
 lab var q11_02b			"Used savings to meet basic needs - Feb 2019"
 lab var q11_02c			"Used savings to meet basic needs - Mar 2019"
 lab var q11_02d			"Used savings to meet basic needs - Apr 2019"
 lab var q11_02e			"Used savings to meet basic needs - May 2019"
 lab var q11_02f			"Used savings to meet basic needs - Jun 2019"
 lab var q11_02g			"Used savings to meet basic needs - Jul 2019"
 lab var q11_02h			"Used savings to meet basic needs - Aug 2019"
 lab var q11_02i			"Used savings to meet basic needs - Sep 2019"
 lab var q11_02j			"Used savings to meet basic needs - Oct 2019"
 lab var q11_02k			"Used savings to meet basic needs - Nov 2019"
 lab var q11_02l			"Used savings to meet basic needs - Dec 2019"
 lab var q11_02z			"Used savings to meet basic needs - DNK 2019"
 lab var q11_03				"Used savings to meet any of the HH basic needs - 2020"
 lab var q11_03_det			"Used savings to meet any of the HH basic needs - 2020 (detail)"
 lab var q11_04a			"Used savings to meet basic needs - Jan 2020"
 lab var q11_04b			"Used savings to meet basic needs - Feb 2020"
 lab var q11_04c			"Used savings to meet basic needs - Mar 2020"
 lab var q11_04d			"Used savings to meet basic needs - Apr 2020"
 lab var q11_04e			"Used savings to meet basic needs - May 2020"
 lab var q11_04f			"Used savings to meet basic needs - Jun 2020"
 lab var q11_04g			"Used savings to meet basic needs - Jul 2020"
 lab var q11_04h			"Used savings to meet basic needs - Aug 2020"
 lab var q11_04i			"Used savings to meet basic needs - Sep 2020"
 lab var q11_04j			"Used savings to meet basic needs - Oct 2020"
 lab var q11_04k			"Used savings to meet basic needs - Nov 2020"
 lab var q11_04l			"Used savings to meet basic needs - Dec 2020"
 lab var q11_04z			"Used savings to meet basic needs - DNK 2020"
 lab var q11_05				"Used savings to meet any of the HH basic needs - 2021"
 lab var q11_05_det			"Used savings to meet any of the HH basic needs - 2021 (detail)"
 lab var q11_06a			"Used savings to meet basic needs - Jan 2021"		
 lab var q11_06b			"Used savings to meet basic needs - Feb 2021"		
 lab var q11_06c			"Used savings to meet basic needs - Mar 2021"		
 lab var q11_06d			"Used savings to meet basic needs - Apr 2021"		
 lab var q11_06e			"Used savings to meet basic needs - May 2021"		
 lab var q11_06f			"Used savings to meet basic needs - Jun 2021"		
 lab var q11_06g			"Used savings to meet basic needs - Jul 2021"		
 lab var q11_06h			"Used savings to meet basic needs - Aug 2021"		
 lab var q11_06i			"Used savings to meet basic needs - Sep 2021"		
 lab var q11_06j			"Used savings to meet basic needs - Oct 2021"		
 lab var q11_06k			"Used savings to meet basic needs - Nov 2021"		
 lab var q11_06l			"Used savings to meet basic needs - Dec 2021"		
 lab var q11_06z			"Used savings to meet basic needs - DNK 2021"		
 lab var q11_07a			"Family loan  - 2019"		
 lab var q11_07b			"Family loan  - 2020"		
 lab var q11_07c			"Family loan  - 2021"		
 lab var q11_07d			"Family loan  - Never"		
 lab var q11_07e			"Family loan  - DNK"		
 lab var q11_08				"Family loan to meet basic needs - 2019"	
 lab var q11_09a			"Family loan to meet basic needs - Jan 2019"	
 lab var q11_09b			"Family loan to meet basic needs - Feb 2019"	
 lab var q11_09c			"Family loan to meet basic needs - Mar 2019"	
 lab var q11_09d			"Family loan to meet basic needs - Apr 2019"	
 lab var q11_09e			"Family loan to meet basic needs - May 2019"	
 lab var q11_09f			"Family loan to meet basic needs - Jun 2019"	
 lab var q11_09g			"Family loan to meet basic needs - Jul 2019"	
 lab var q11_09h			"Family loan to meet basic needs - Aug 2019"	
 lab var q11_09i			"Family loan to meet basic needs - Sep 2019"	
 lab var q11_09j			"Family loan to meet basic needs - Oct 2019"	
 lab var q11_09k			"Family loan to meet basic needs - Nov 2019"	
 lab var q11_09l			"Family loan to meet basic needs - Dec 2019"	
 lab var q11_09z			"Family loan to meet basic needs - DNK 2019"	
 lab var q11_10				"Able to meet family loans payments - 2019"
 lab var q11_11a			"Not able to payback family loan - Jan 2019"	
 lab var q11_11b			"Not able to payback family loan - Feb 2019"	
 lab var q11_11c			"Not able to payback family loan - Mar 2019"	
 lab var q11_11d			"Not able to payback family loan - Apr 2019"	
 lab var q11_11e			"Not able to payback family loan - May 2019"	
 lab var q11_11f			"Not able to payback family loan - Jun 2019"	
 lab var q11_11g			"Not able to payback family loan - Jul 2019"	
 lab var q11_11h			"Not able to payback family loan - Aug 2019"	
 lab var q11_11i			"Not able to payback family loan - Sep 2019"	
 lab var q11_11j			"Not able to payback family loan - Oct 2019"	
 lab var q11_11k			"Not able to payback family loan - Nov 2019"	
 lab var q11_11l			"Not able to payback family loan - Dec 2019"	
 lab var q11_11z			"Not able to payback family loan - DNK 2019"	
 lab var q11_12				"Family loan to meet basic needs - 2020"	
 lab var q11_13a			"Family loan to meet basic needs - Jan 2020"	
 lab var q11_13b			"Family loan to meet basic needs - Feb 2020"	
 lab var q11_13c			"Family loan to meet basic needs - Mar 2020"	
 lab var q11_13d			"Family loan to meet basic needs - Apr 2020"	
 lab var q11_13e			"Family loan to meet basic needs - May 2020"	
 lab var q11_13f			"Family loan to meet basic needs - Jun 2020"	
 lab var q11_13g			"Family loan to meet basic needs - Jul 2020"	
 lab var q11_13h			"Family loan to meet basic needs - Aug 2020"	
 lab var q11_13i			"Family loan to meet basic needs - Sep 2020"	
 lab var q11_13j			"Family loan to meet basic needs - Oct 2020"	
 lab var q11_13k			"Family loan to meet basic needs - Nov 2020"	
 lab var q11_13l			"Family loan to meet basic needs - Dec 2020"	
 lab var q11_13z			"Family loan to meet basic needs - DNK 2020"	
 lab var q11_14				"Able to meet family loans payments - 2020"	
 lab var q11_15a			"Not able to payback family loan - Jan 2020"		
 lab var q11_15b			"Not able to payback family loan - Feb 2020"		
 lab var q11_15c			"Not able to payback family loan - Mar 2020"		
 lab var q11_15d			"Not able to payback family loan - Apr 2020"		
 lab var q11_15e			"Not able to payback family loan - May 2020"		
 lab var q11_15f			"Not able to payback family loan - Jun 2020"		
 lab var q11_15g			"Not able to payback family loan - Jul 2020"		
 lab var q11_15h			"Not able to payback family loan - Aug 2020"		
 lab var q11_15i			"Not able to payback family loan - Sep 2020"		
 lab var q11_15j			"Not able to payback family loan - Oct 2020"		
 lab var q11_15k			"Not able to payback family loan - Nov 2020"		
 lab var q11_15l			"Not able to payback family loan - Dec 2020"		
 lab var q11_15z			"Not able to payback family loan - DNK 2020"		
 lab var q11_16				"Family loan to meet basic needs - 2021"	
 lab var q11_17a            "Family loan to meet basic needs - Jan 2021"	
 lab var q11_17b            "Family loan to meet basic needs - Feb 2021"	
 lab var q11_17c            "Family loan to meet basic needs - Mar 2021"	
 lab var q11_17d            "Family loan to meet basic needs - Apr 2021"	
 lab var q11_17e            "Family loan to meet basic needs - May 2021"	
 lab var q11_17f            "Family loan to meet basic needs - Jun 2021"	
 lab var q11_17g            "Family loan to meet basic needs - Jul 2021"	
 lab var q11_17h            "Family loan to meet basic needs - Aug 2021"	
 lab var q11_17i            "Family loan to meet basic needs - Sep 2021"	
 lab var q11_17j            "Family loan to meet basic needs - Oct 2021"	
 lab var q11_17k            "Family loan to meet basic needs - Nov 2021"	
 lab var q11_17l            "Family loan to meet basic needs - Dec 2021"	
 lab var q11_17z            "Family loan to meet basic needs - DNK 2021"	
 lab var q11_18             "Able to meet family loans payments - 2021"
 lab var q11_19a            "Not able to payback family loan - Jan 2021"	
 lab var q11_19b            "Not able to payback family loan - Feb 2021"	
 lab var q11_19c            "Not able to payback family loan - Mar 2021"	
 lab var q11_19d            "Not able to payback family loan - Apr 2021"	
 lab var q11_19e            "Not able to payback family loan - May 2021"	
 lab var q11_19f            "Not able to payback family loan - Jun 2021"	
 lab var q11_19g            "Not able to payback family loan - Jul 2021"	
 lab var q11_19h            "Not able to payback family loan - Aug 2021"	
 lab var q11_19i            "Not able to payback family loan - Sep 2021"	
 lab var q11_19j            "Not able to payback family loan - Oct 2021"	
 lab var q11_19k            "Not able to payback family loan - Nov 2021"	
 lab var q11_19l            "Not able to payback family loan - Dec 2021"	
 lab var q11_19z            "Not able to payback family loan - DNK 2021"	
 lab var q11_20a			"Informal credit (moneylenders) - 2019"
 lab var q11_20b			"Informal credit (moenylenders) - 2020" 			
 lab var q11_20c			"Informal credit (moenylenders) - 2021" 	
 lab var q11_20d			"Informal credit (moenylenders) - Never" 	
 lab var q11_20e			"Informal credit (moenylenders) - DNK" 	
 lab var q11_21				"Informal credit (moneylenders) - 2019"	
 lab var q11_22a			"Informal credit (moneylenders) - Jan 2019"	
 lab var q11_22b        	"Informal credit (moneylenders) - Feb 2019"
 lab var q11_22c        	"Informal credit (moneylenders) - Mar 2019"
 lab var q11_22d        	"Informal credit (moneylenders) - Apr 2019"
 lab var q11_22e        	"Informal credit (moneylenders) - May 2019"
 lab var q11_22f        	"Informal credit (moneylenders) - Jun 2019"
 lab var q11_22g        	"Informal credit (moneylenders) - Jul 2019"
 lab var q11_22h        	"Informal credit (moneylenders) - Aug 2019"
 lab var q11_22i        	"Informal credit (moneylenders) - Sep 2019"
 lab var q11_22j        	"Informal credit (moneylenders) - Oct 2019"
 lab var q11_22k        	"Informal credit (moneylenders) - Nov 2019"
 lab var q11_22l        	"Informal credit (moneylenders) - Dec 2019"
 lab var q11_22z        	"Informal credit (moneylenders) - DNK 2019"
 lab var q11_22aa       	"Able to meet moneylenders payments - 2019"
 lab var q11_22bba      	"Not able to payback moneylenders loan - Jan 2019"
 lab var q11_22bbb      	"Not able to payback moneylenders loan - Feb 2019"
 lab var q11_22bbc          "Not able to payback moneylenders loan - Mar 2019"
 lab var q11_22bbd          "Not able to payback moneylenders loan - Apr 2019"
 lab var q11_22bbe          "Not able to payback moneylenders loan - May 2019"
 lab var q11_22bbf          "Not able to payback moneylenders loan - Jun 2019"
 lab var q11_22bbg          "Not able to payback moneylenders loan - Jul 2019"
 lab var q11_22bbh          "Not able to payback moneylenders loan - Aug 2019"
 lab var q11_22bbi          "Not able to payback moneylenders loan - Sep 2019"
 lab var q11_22bbj          "Not able to payback moneylenders loan - Oct 2019"
 lab var q11_22bbk          "Not able to payback moneylenders loan - Nov 2019"
 lab var q11_22bbl          "Not able to payback moneylenders loan - Dec 2019"
 lab var q11_22bbz          "Not able to payback moneylenders loan - DNK 2019" 
 lab var q11_23             "Informal credit (moneylender) - 2020"	
 lab var q11_24a      		"Informal credit (moneylender) - Jan 2020"
 lab var q11_24b      		"Informal credit (moneylender) - Feb 2020"
 lab var q11_24c      		"Informal credit (moneylender) - Mar 2020"
 lab var q11_24d      		"Informal credit (moneylender) - Apr 2020"
 lab var q11_24e      		"Informal credit (moneylender) - May 2020"
 lab var q11_24f      		"Informal credit (moneylender) - Jun 2020"
 lab var q11_24g      		"Informal credit (moneylender) - Jul 2020"
 lab var q11_24h      		"Informal credit (moneylender) - Aug 2020"
 lab var q11_24i      		"Informal credit (moneylender) - Sep 2020"
 lab var q11_24j      		"Informal credit (moneylender) - Oct 2020"
 lab var q11_24k      		"Informal credit (moneylender) - Nov 2020"
 lab var q11_24l      		"Informal credit (moneylender) - Dec 2020"
 lab var q11_24z      		"Informal credit (moneylender) - DNK 2020"
 lab var q11_24aa     		"Able to meet moneylenders payments - 2020"	
 lab var q11_24bba    		"Not able to payback moneylenders loan - Jan 2020"
 lab var q11_24bbb    		"Not able to payback moneylenders loan - Feb 2020"
 lab var q11_24bbc    		"Not able to payback moneylenders loan - Mar 2020"
 lab var q11_24bbd    		"Not able to payback moneylenders loan - Apr 2020"
 lab var q11_24bbe    		"Not able to payback moneylenders loan - May 2020"
 lab var q11_24bbf    		"Not able to payback moneylenders loan - Jun 2020"
 lab var q11_24bbg    		"Not able to payback moneylenders loan - Jul 2020"
 lab var q11_24bbh    		"Not able to payback moneylenders loan - Aug 2020"
 lab var q11_24bbi    		"Not able to payback moneylenders loan - Sep 2020"
 lab var q11_24bbj    		"Not able to payback moneylenders loan - Oct 2020"
 lab var q11_24bbk    		"Not able to payback moneylenders loan - Nov 2020"
 lab var q11_24bbl    		"Not able to payback moneylenders loan - Dec 2020"
 lab var q11_24bbz    		"Not able to payback moneylenders loan - DNK 2020"
 lab var q11_25             "Informal credit (moneylender) - 2021"	
 lab var q11_26a      		"Informal credit (moneylender) - Jan 2021" 
 lab var q11_26b      		"Informal credit (moneylender) - Feb 2021" 
 lab var q11_26c      		"Informal credit (moneylender) - Mar 2021" 
 lab var q11_26d      		"Informal credit (moneylender) - Apr 2021" 
 lab var q11_26e      		"Informal credit (moneylender) - May 2021" 
 lab var q11_26f      		"Informal credit (moneylender) - Jun 2021" 
 lab var q11_26g      		"Informal credit (moneylender) - Jul 2021" 
 lab var q11_26h      		"Informal credit (moneylender) - Aug 2021" 
 lab var q11_26i      		"Informal credit (moneylender) - Sep 2021" 
 lab var q11_26j      		"Informal credit (moneylender) - Oct 2021" 
 lab var q11_26k      		"Informal credit (moneylender) - Nov 2021" 
 lab var q11_26l      		"Informal credit (moneylender) - Dec 2021" 
 lab var q11_26z      		"Informal credit (moneylender) - DNK 2021" 
 lab var q11_26aa     		"Able to meet moneylenders payments - 2021"	 
 lab var q11_26bba    		"Not able to payback moneylenders loan - Jan 2021" 
 lab var q11_26bbb    		"Not able to payback moneylenders loan - Feb 2021" 
 lab var q11_26bbc    		"Not able to payback moneylenders loan - Mar 2021" 
 lab var q11_26bbd    		"Not able to payback moneylenders loan - Apr 2021" 
 lab var q11_26bbe    		"Not able to payback moneylenders loan - May 2021" 
 lab var q11_26bbf    		"Not able to payback moneylenders loan - Jun 2021" 
 lab var q11_26bbg    		"Not able to payback moneylenders loan - Jul 2021" 
 lab var q11_26bbh    		"Not able to payback moneylenders loan - Aug 2021" 
 lab var q11_26bbi    		"Not able to payback moneylenders loan - Sep 2021" 
 lab var q11_26bbj    		"Not able to payback moneylenders loan - Oct 2021" 
 lab var q11_26bbk    		"Not able to payback moneylenders loan - Nov 2021" 
 lab var q11_26bbl    		"Not able to payback moneylenders loan - Dec 2021" 
 lab var q11_26bbz    		"Not able to payback moneylenders loan - DNK 2021"  
 lab var q11_27a            "Received food/money gift - 2019"
 lab var q11_27b            "Received food/money gift - 2020"
 lab var q11_27c            "Received food/money gift - 2021"
 lab var q11_27d            "Received food/money gift - Never"
 lab var q11_27e			"Received food/money gift - DNK"	
 lab var q11_28             "Received food/money gift - 2019"	
 lab var q11_29a			"Received food/money gift - Jan 2019"
 lab var q11_29b			"Received food/money gift - Feb 2019"
 lab var q11_29c			"Received food/money gift - Mar 2019"
 lab var q11_29d			"Received food/money gift - Apr 2019"
 lab var q11_29e			"Received food/money gift - May 2019"
 lab var q11_29f			"Received food/money gift - Jun 2019"
 lab var q11_29g			"Received food/money gift - Jul 2019"
 lab var q11_29h			"Received food/money gift - Aug 2019"
 lab var q11_29i			"Received food/money gift - Sep 2019"
 lab var q11_29j			"Received food/money gift - Oct 2019"
 lab var q11_29k			"Received food/money gift - Nov 2019"
 lab var q11_29l			"Received food/money gift - Dec 2019"
 lab var q11_29z			"Received food/money gift - DNK 2019"
 lab var q11_30 			"Received food/money gift - 2020"	
 lab var q11_31a			"Received food/money gift - Jan 2020"
 lab var q11_31b			"Received food/money gift - Feb 2020"
 lab var q11_31c			"Received food/money gift - Mar 2020"
 lab var q11_31d			"Received food/money gift - Apr 2020"
 lab var q11_31e			"Received food/money gift - May 2020"
 lab var q11_31f			"Received food/money gift - Jun 2020"
 lab var q11_31g			"Received food/money gift - Jul 2020"
 lab var q11_31h			"Received food/money gift - Aug 2020"
 lab var q11_31i			"Received food/money gift - Sep 2020"
 lab var q11_31j			"Received food/money gift - Oct 2020"
 lab var q11_31k			"Received food/money gift - Nov 2020"
 lab var q11_31l			"Received food/money gift - Dec 2020"
 lab var q11_31z			"Received food/money gift - DNK 2020"
 lab var q11_32 			"Received food/money gift - 2021"	
 lab var q11_33a			"Received food/money gift - Jan 2021"
 lab var q11_33b			"Received food/money gift - Feb 2021"
 lab var q11_33c			"Received food/money gift - Mar 2021"
 lab var q11_33d			"Received food/money gift - Apr 2021"
 lab var q11_33e			"Received food/money gift - May 2021"
 lab var q11_33f			"Received food/money gift - Jun 2021"
 lab var q11_33g			"Received food/money gift - Jul 2021"
 lab var q11_33h			"Received food/money gift - Aug 2021"
 lab var q11_33i			"Received food/money gift - Sep 2021"
 lab var q11_33j			"Received food/money gift - Oct 2021"
 lab var q11_33k			"Received food/money gift - Nov 2021"
 lab var q11_33l			"Received food/money gift - Dec 2021"
 lab var q11_33z			"Received food/money gift - DNK 2021"
 
 //>>>> 2.11.4. Section ordering
 order  q11_01* q11_02a q11_02b q11_02c q11_02d q11_02e q11_02f q11_02g q11_02h q11_02i q11_02j q11_02k q11_02l q11_02z q11_03* q11_04a q11_04b q11_04c q11_04d q11_04e q11_04f q11_04g q11_04h q11_04i q11_04j q11_04k q11_04l q11_04z q11_05* q11_06a q11_06b q11_06c q11_06d q11_06e q11_06f q11_06g q11_06h q11_06i q11_06j q11_06k q11_06l q11_06z q11_07a q11_07b q11_07c q11_07d q11_07e q11_08 q11_09a q11_09b q11_09c q11_09d q11_09e q11_09f q11_09g q11_09h q11_09i q11_09j q11_09k q11_09l q11_09z q11_10 q11_11a q11_11b q11_11c q11_11d q11_11e q11_11f q11_11g q11_11h q11_11i q11_11j q11_11k q11_11l q11_11z q11_12 q11_13a q11_13b q11_13c q11_13d q11_13e q11_13f q11_13g q11_13h q11_13i q11_13j q11_13k q11_13l q11_13z q11_14 q11_15a q11_15b q11_15c q11_15d q11_15e q11_15f q11_15g q11_15h q11_15i q11_15j q11_15k q11_15l q11_15z q11_16 q11_17a q11_17b q11_17c q11_17d q11_17e q11_17f q11_17g q11_17h q11_17i q11_17j q11_17k q11_17l q11_17z q11_18  q11_19a q11_19b q11_19c q11_19d q11_19e q11_19f q11_19g q11_19h q11_19i q11_19j q11_19k q11_19l q11_19z q11_20a q11_20b q11_20c q11_20d q11_20e q11_21 q11_22a q11_22b q11_22c q11_22d q11_22e q11_22f q11_22g q11_22h q11_22i q11_22j q11_22k q11_22l q11_22z q11_22aa  q11_22bba q11_22bbb q11_22bbc q11_22bbd q11_22bbe q11_22bbf q11_22bbg q11_22bbh q11_22bbi q11_22bbj q11_22bbk q11_22bbl q11_22bbz q11_23  q11_24a q11_24b q11_24c q11_24d q11_24e q11_24f q11_24g q11_24h q11_24i q11_24j q11_24k q11_24l q11_24z q11_24aa  q11_24bba q11_24bbb q11_24bbc q11_24bbd q11_24bbe q11_24bbf q11_24bbg q11_24bbh q11_24bbi q11_24bbj q11_24bbk q11_24bbl q11_24bbz q11_25  q11_26a q11_26b q11_26c q11_26d q11_26e q11_26f q11_26g q11_26h q11_26i q11_26j q11_26k q11_26l q11_26z q11_26aa  q11_26bba q11_26bbb q11_26bbc q11_26bbd q11_26bbe q11_26bbf q11_26bbg q11_26bbh q11_26bbi q11_26bbj q11_26bbk q11_26bbl q11_26bbz q11_27a q11_27b q11_27c q11_27d q11_27e q11_28  q11_29a q11_29b q11_29c q11_29d q11_29e q11_29f q11_29g q11_29h q11_29i q11_29j q11_29k q11_29l q11_29z q11_30  q11_31a q11_31b q11_31c q11_31d q11_31e q11_31f q11_31g q11_31h q11_31i q11_31j q11_31k q11_31l q11_31z q11_32  q11_33a q11_33b q11_33c q11_33d q11_33e q11_33f q11_33g q11_33h q11_33i q11_33j q11_33k q11_33l q11_33z, after(credit_18z)

 rename q11_* fin_*
 
 //>>>>> Replace conditinal valued answers 
 
 * used savings // didnt used savings 
 
 // 2019
 foreach v in fin_02a fin_02b fin_02c fin_02d fin_02e fin_02f fin_02g fin_02h fin_02i fin_02j fin_02k fin_02l fin_02z {
	replace `v' = 0 if fin_01 == 0
 }
 
 // 2020
 foreach v in fin_04a fin_04b fin_04c fin_04d fin_04e fin_04f fin_04g fin_04h fin_04i fin_04j fin_04k fin_04l fin_04z {
	replace `v' = 0 if fin_03 == 0
 }
 
 // 2021
 foreach v in fin_06a fin_06b fin_06c fin_06d fin_06e fin_06f fin_06g fin_06h fin_06i fin_06j fin_06k fin_06l fin_06z {
	replace `v' = 0 if fin_05 == 0
 }
 
 * family loan 
 replace fin_07e = 0 if fin_07e == .
 replace fin_07d = 0 if fin_07d == . & fin_07e == 0
 foreach v in fin_07a fin_07b fin_07c {
 	replace `v' = 0 if fin_07d == 1
	replace `v' = . if fin_07e == 1
	replace `v' = 0 if fin_07e == 0 & `v' == .
 }
 
 foreach v in fin_08 fin_09a fin_09b fin_09c fin_09d fin_09e fin_09f fin_09g fin_09h fin_09i fin_09j fin_09k fin_09l fin_09z fin_10 fin_11a fin_11b fin_11c fin_11d fin_11e fin_11f fin_11g fin_11h fin_11i fin_11j fin_11k fin_11l fin_11z fin_12 fin_13a fin_13b fin_13c fin_13d fin_13e fin_13f fin_13g fin_13h fin_13i fin_13j fin_13k fin_13l fin_13z fin_14 fin_15a fin_15b fin_15c fin_15d fin_15e fin_15f fin_15g fin_15h fin_15i fin_15j fin_15k fin_15l fin_15z fin_16 fin_17a fin_17b fin_17c fin_17d fin_17e fin_17f fin_17g fin_17h fin_17i fin_17j fin_17k fin_17l fin_17z fin_18 fin_19a fin_19b fin_19c fin_19d fin_19e fin_19f fin_19g fin_19h fin_19i fin_19j fin_19k fin_19l fin_19z {
	replace `v' = 0 if fin_07d == 1
	replace `v' = 0 if fin_07e == 0 & `v' == .	
 }
 
 *informal credit
 replace fin_20e = 0 if fin_20e == .
 replace fin_20d = 0 if fin_20d == . & fin_20e == 0
 foreach v in fin_20a fin_20b fin_20c {
 	replace `v' = 0 if fin_20d == 1
	replace `v' = . if fin_20e == 1
	replace `v' = 0 if fin_20e == 0 & `v' == .
 }
 
 *2019
 foreach v in fin_21 fin_22a fin_22b fin_22c fin_22d fin_22e fin_22f fin_22g fin_22h fin_22i fin_22j fin_22k fin_22l fin_22z {
	replace `v' = 0 if fin_20d == 1
	replace `v' = 0 if fin_20e == 0 & `v' == .	
 }
 
 foreach v in fin_22bba fin_22bbb fin_22bbc fin_22bbd fin_22bbe fin_22bbf fin_22bbg fin_22bbh fin_22bbi fin_22bbj fin_22bbk fin_22bbl fin_22bbz {
	replace `v' = 0 if fin_22aa == 1 // met all 
 }
 
 *2020
 foreach v in fin_23 fin_24a fin_24b fin_24c fin_24d fin_24e fin_24f fin_24g fin_24h fin_24i fin_24j fin_24k fin_24l fin_24z {
	replace `v' = 0 if fin_20d == 1
	replace `v' = 0 if fin_20e == 0 & `v' == .	
 }
 
 foreach v in fin_24bba fin_24bbb fin_24bbc fin_24bbd fin_24bbe fin_24bbf fin_24bbg fin_24bbh fin_24bbi fin_24bbj fin_24bbk fin_24bbl fin_24bbz {
	replace `v' = 0 if fin_24aa == 1 // met all 
 }
 
 *2021
 foreach v in fin_25 fin_26a fin_26b fin_26c fin_26d fin_26e fin_26f fin_26g fin_26h fin_26i fin_26j fin_26k fin_26l fin_26z {
	replace `v' = 0 if fin_20d == 1
	replace `v' = 0 if fin_20e == 0 & `v' == .	
 }
 
 foreach v in fin_26bba fin_26bbb fin_26bbc fin_26bbd fin_26bbe fin_26bbf fin_26bbg fin_26bbh fin_26bbi fin_26bbj fin_26bbk fin_26bbl fin_26bbz {
	replace `v' = 0 if fin_26aa == 1 // met all 
 }
 
 *gifts
 
 *informal credit
 replace fin_27e = 0 if fin_27e == .
 replace fin_27d = 0 if fin_27d == . & fin_27e == 0
 foreach v in fin_27a fin_27b fin_27c {
 	replace `v' = 0 if fin_27d == 1
	replace `v' = . if fin_27e == 1
	replace `v' = 0 if fin_27e == 0 & `v' == .
 }
 
 foreach v in fin_28 fin_29a fin_29b fin_29c fin_29d fin_29e fin_29f fin_29g fin_29h fin_29i fin_29j fin_29k fin_29l fin_29z fin_30 fin_31a fin_31b fin_31c fin_31d fin_31e fin_31f fin_31g fin_31h fin_31i fin_31j fin_31k fin_31l fin_31z fin_32 fin_33a fin_33b fin_33c fin_33d fin_33e fin_33f fin_33g fin_33h fin_33i fin_33j fin_33k fin_33l fin_33z {
	replace `v' = 0 if fin_27d == 1
	replace `v' = 0 if fin_27e == 0 & `v' == .	
 }
 
 /*==================================================
 			3:  Add SISBEN
 ==================================================*/


/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
  
 *--------- 3.1 Add SISBEN missing info 
 
 //some SISBEN variables have been renamed or drop 
 loc sisbenvars $sisbenvar
 foreach v of global sisbenvar {
 	cap confirm v `v'
	if _rc 	loc sisbenvars = subinstr("`sisbenvars'", "`v'", "" ,.)
 }
 
 order `sisbenvars', last

 
 *--------- 3.1 Adjust SISBEN vars at 2019 prices 
 
 glo inc_sisben inc1 inc_t inc_nt_t inc_t_w inc_nt_t_w pp_inc pp_inc_nt inc_wage inc_fees inc_harvest inc_pension inc_remittance_local inc_remittance_inter inc_rent inc_familias_accion inc_col_mayor inc_other_subsidies
 
 glo exp_sisben pc_exp total_expenditure exp_food exp_transport exp_education exp_health exp_public_services exp_cellphone exp_rent exp_other total_expenditure
 
 // most of these should be at 2017 prices, we adjust to NOV 2019 prices asumming data gathering took place on NOV 2017
 // multiplier to adjust by inflation
 
 foreach v in $inc_sisben $exp_sisben {
	replace `v' = (`v' * 1.0724) // deflactor IPC2019/IPC2017 at nov values
 }
 
  ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/


 /*==================================================
 		Add poverty lines 
 ==================================================*/

 /* Important note:
  originally this was added true the admin cleaning and merging but for replication proposuses is added here.
  It may be the case that the department infomation is missing in the survey but not in admin data, hence
  is possible more data is missing here compared to the final dataset provided */ 
 
 // harmonise dep variable for merge
 tostring cod_dpto, gen(temp0)
 replace temp0 = substr(temp0, 3, .)
 destring temp0, gen(cod_dpto_sf)
 drop temp0


 *--------- 4.1 Povertylines 
 
 //>>>>>>>> 2.1.2.1 add poverty-lines
 preserve 
 
 
 import excel "${dir2r}/_aux/DANE_povlines_depto_city.xlsx", clear sheet("all") first
 
 drop if missing(depto_name) // empty rows 
 
 forv i = 2019/2021 {
	 foreach j in "" "e" {
		 
		 gen _aux = `j'povline_depto_`i' if depto_name == "Total Nacional"
		 egen nat_`j'pvl_`i' = max(_aux)
		 drop _aux 
		 
		 gen _aux = `j'povline_depto_`i' if depto_name == "Rural"
		 egen nat_rural_`j'pvl_`i' = max(_aux)
		 drop _aux 
		 
		 if ("`j'" == "e")	loc tp "Extreme poverty line"
		 else				loc tp "Poverty line"
		 
		 lab var `j'povline_depto_`i' 	"`tp' dept. - `i'"
		 lab var `j'povline_city_`i' 	"`tp' dept. capital - `i'"
		 lab var nat_`j'pvl_`i' 		"`tp' (National) - `i'"
		 lab var nat_rural_`j'pvl_`i' 	"`tp' (National - rural areas) - `i'"
		 
	 }	
 }
 
 drop if inlist(depto_name, "Total Nacional", "Rural")
 
 drop if depto_name == ""
 drop depto_name city_name
  
 destring depto_code, gen(cod_dpto_sf) 
 drop depto_code
  
 tempfile povlines
 save `povlines'
 
 restore 
 
 merge m:1 cod_dpto_sf using `povlines'
 
 * replace for national if missing 
 foreach v in nat_pvl_2019 nat_rural_pvl_2019 nat_epvl_2019 nat_rural_epvl_2019 nat_pvl_2020 nat_rural_pvl_2020 nat_epvl_2020 nat_rural_epvl_2020 nat_pvl_2021 nat_rural_pvl_2021 nat_epvl_2021 nat_rural_epvl_2021 {
		sum `v'
		replace `v' = r(mean) if _merge == 1
 }
  
  forv i = 2019/2021 {
	 foreach j in "" "e" {
		replace `j'povline_depto_`i' =  nat_`j'pvl_`i' if _merge == 1		
	 }
  }
 
 drop if _merge == 2
 drop _merge

 *--------- 4.1 PPP final consumption (source WB) 
 *--- Added on: AUG30 , 2022
 
 gen CountryCode = "COL"
 
 preserve 
 
 import excel "${dir2}/_aux/PPP_consmption_WB.xls", clear sheet("Data")  ///
 cellrange(A4) first
 
 foreach v of varlist _all {
 	loc vlab: var label `v'
	lab var `v' "PPP consumption - `vlab'"
	
	loc t= 0
	cap loc t = inrange(`vlab',1950,3000) 
	if (`t' == 1)	rename `v' ppp_`vlab'
	
 }
 
 keep CountryCode ppp_2019 ppp_2020 ppp_2021
 keep if CountryCode == "COL"
 
 tempfile ppp
 save `ppp'
 
 restore 
 
 
 merge m:1 CountryCode using `ppp', nogen
 
 drop CountryCode
 
 /*==================================================
 		3: Additional variable transformations
 ==================================================*/
  
 *---------- 1.2: Data transformations 
 
 * Inflation adjustments 
 * multiplier
 scalar pi_2020 = 0.984
 scalar pi_2021 = 0.941
 
 ** income to constant prices nov 2019
 loc k = 0
 foreach t in "15" "08" "01"  {
	loc y = 2019+`k'
	loc j = `t' + 2 
	if length("`j'") == 1		loc j = "0" + "`j'"
	
	// multiplier to adjust by inflation
	if (`y'==2020)			loc mult "* `=pi_2020' "
	if (`y'==2021)			loc mult "* `=pi_2021'"
	else 					loc mult ""
	
	replace income_`t' = (income_`t' `mult' )
	replace income_`j'c = (income_`j'c `mult' )
	
	loc ++k
 }
 
 ** PP income
 gen income_01_pp =  income_01 / hh_07 
 gen income_08_pp =  income_08 / hh_07 
 gen income_15_pp =  income_15 / hh_09
 
 
 ** PP income - transfers 
 gen income_01_pp_nt = (income_01 - income_03c) / hh_07
 gen income_08_pp_nt = (income_08 - income_10c) / hh_07
 gen income_15_pp_nt = (income_15 - income_17c) / hh_09
 replace income_01_pp_nt = 0 if income_01_pp_nt < 0
 replace income_08_pp_nt = 0 if income_08_pp_nt < 0
 replace income_15_pp_nt = 0 if income_15_pp_nt < 0
 
 ** poverty 
 loc k = 0
 foreach t in "15" "08" "01"  {
	loc y = 2019+`k'
	
	gen extreme_poverty_`y' = income_`t'_pp < epovline_depto_2019 if !missing(income_`t'_pp)
	gen poverty_`y' 		= income_`t'_pp < povline_depto_2019  if !missing(income_`t'_pp)
	
	loc ++k
 
 }
 
 * excluding transfers
 loc k = 0
 foreach t in "15" "08" "01"  {
	loc y = 2019+`k'
	
	gen extreme_poverty_nt_`y' = income_`t'_pp_nt < epovline_depto_2019 if !missing(income_`t'_pp)
	gen poverty_nt_`y' 		= income_`t'_pp_nt < povline_depto_2019  if !missing(income_`t'_pp)
	
	lab var extreme_poverty_nt_`y'	"Extreme poverty `y' - excl. poverty"
	lab var poverty_nt_`y'			"Poverty `y' - excl. poverty"
	
	loc ++k
 
 }
 
 
  ** transformations
 loc y = 2019
 foreach v in income_15_pp income_08_pp income_01_pp income_15_pp_nt income_08_pp_nt income_01_pp_nt {	
	winsor2 `v', s(_win) c(0 90) 			// winsorisation 
	gen `v'_ppp = `v'_win / ppp_2019		// PPP income - 2019 int USD
	gen ihs`v' = asinh(`v'_win)				// IHS income 
	gen l`v' = ln(`v'_win)					// log income
	
	loc vlab: var label `v'
	
	lab var `v'_win		"`vlab' winsorised"
	lab var `v'_ppp		"`vlab' PPP"
	
 }
 
  *----------  1.x. Admin data income transformation 
/*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
  gen ihs_pp_inc = asinh(pp_inc_nt) // Inverse hyperbolic sine of PP income net of transfers
  gen l_pp_inc = log(pp_inc_nt) // Inverse hyperbolic sine of PP income net of transfers
  replace l_pp_inc = 0 if pp_inc_nt == 0 // equivalent to give them one 1 COP --> 0
----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/

 
 *-------- 1.3. Income changes 
 
 gen d_income_2021 = income_01_pp - income_08_pp
 gen d_income_2020 = income_08_pp - income_15_pp
  
 *gen d_lincome_2021 = lincome_01_pp - lincome_08_pp
 *gen d_lincome_2020 = lincome_08_pp - lincome_15_pp
 
 gen d_ihsincome_2021 = ihsincome_01_pp - ihsincome_08_pp
 gen d_ihsincome_2020 = ihsincome_08_pp - ihsincome_15_pp
   
 gen d_income_nt_2021 = income_01_pp_nt - income_08_pp_nt
 gen d_income_nt_2020 = income_08_pp_nt - income_15_pp_nt
 
 gen d_ihsincome_nt_2021 = ihsincome_01_pp_nt - ihsincome_08_pp_nt
 gen d_ihsincome_nt_2020 = ihsincome_08_pp_nt - ihsincome_15_pp_nt
 
 * education regrouping 
 gen hh_16_no = hh_16aa == 1 | hh_16ab == 1 , before(hh_16aa) 				// none or pre
 gen hh_16_elementary = hh_16ac == 1 | hh_16ad == 1 , before(hh_16aa) 		// prim or mid
 gen hh_16_high = hh_16ae == 1 , before(hh_16aa)
 gen hh_16_tertiary = hh_16af == 1 | hh_16ag == 1 | hh_16ah == 1 , before(hh_16aa) // tech, uni , post
 
 lab var hh_16_no			"Education: None"
 lab var hh_16_elementary	"Education: Elementary"
 lab var hh_16_high 		"Education: Highschool"
 lab var hh_16_tertiary		"Education: Tertiary"
 
 foreach v in hh_16_no hh_16_elementary hh_16_high hh_16_tertiary {
 	replace `v' = . if 	hh_16ai == 1
 }
 
 * share of kids
 gen hh_10b = hh_09 - hh_10 
 gen hh_10c = hh_10b / hh_09
 lab var hh_10c "Proportion of kids (under 18)"
 lab var hh_10b "Kids (under 18)"
 
 /*----------------------------------------------------------------------
		-------------------- ADMIN DATA 	-----------------------
------------------------------------------------------------------------
** one last minor change 
 egen cookpower_finished =rowmax(cookpower_electric cookpower_natgas)
 lab var cookpower_finished "Cooking power gas or electric"
 order cookpower_finished , before(cookpower_electric)
 ----------------------------------------------------------------------
	-------------------- ADMIN DATA END 	-----------------------
------------------------------------------------------------------------*/


 
 /*==================================================
 			3: Final save
 ==================================================*/
  
 *----------3.1: Final save 
 
 save "${dir3r}/01_survey/replica/survey_targeting_r1.dta" , replace
  
 
exit
/* End of do-file */

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

Notes:
1.
2.
3.


Version Control:


